Package com.tngtech.archunit.core.domain
Class AccessTarget.MethodCallTarget
java.lang.Object
com.tngtech.archunit.core.domain.AccessTarget
com.tngtech.archunit.core.domain.AccessTarget.CodeUnitAccessTarget
com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget
com.tngtech.archunit.core.domain.AccessTarget.MethodCallTarget
- All Implemented Interfaces:
HasDescription
,CanBeAnnotated
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
,HasParameterTypes
,HasReturnType
,HasThrowsClause<AccessTarget.CodeUnitAccessTarget>
- Enclosing class:
- AccessTarget
@PublicAPI(usage=ACCESS)
public static final class AccessTarget.MethodCallTarget
extends AccessTarget.CodeUnitCallTarget
Represents a
AccessTarget.CodeUnitCallTarget
where the target is a method. For further elaboration about the necessity to distinguish
MethodCallTarget
from JavaMethod
refer to the documentation at AccessTarget
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Predefinedfunctions
to transformAccessTarget.MethodCallTarget
.Nested classes/interfaces inherited from class com.tngtech.archunit.core.domain.AccessTarget
AccessTarget.CodeUnitAccessTarget, AccessTarget.CodeUnitCallTarget, AccessTarget.CodeUnitReferenceTarget, AccessTarget.ConstructorCallTarget, AccessTarget.ConstructorReferenceTarget, AccessTarget.FieldAccessTarget, AccessTarget.MethodCallTarget, AccessTarget.MethodReferenceTarget, AccessTarget.Predicates
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.CanBeAnnotated
CanBeAnnotated.Utils
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasName
HasName.AndFullName, HasName.Utils
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasParameterTypes
HasParameterTypes.Predicates
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasReturnType
HasReturnType.Predicates
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasThrowsClause
HasThrowsClause.Predicates
-
Method Summary
Modifier and TypeMethodDescriptionAttempts to resolve an imported method that matches this target.Methods inherited from class com.tngtech.archunit.core.domain.AccessTarget.CodeUnitAccessTarget
getParameterTypes, getRawParameterTypes, getRawReturnType, getReturnType
Methods inherited from class com.tngtech.archunit.core.domain.AccessTarget
equals, getFullName, getName, getOwner, hashCode, isAnnotatedWith, isAnnotatedWith, isAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, toString
-
Method Details
-
getThrowsClause
- Specified by:
getThrowsClause
in interfaceHasThrowsClause<AccessTarget.CodeUnitAccessTarget>
- Overrides:
getThrowsClause
in classAccessTarget.CodeUnitCallTarget
-
resolveMember
Attempts to resolve an imported method that matches this target. Note that while usually the respective method is clear from the context, there are more complicated scenarios. Consider for example
At runtime the target will be clear, but considering only this bytecode there seem to be two valid candidates we could pick as the referenced method. To resolve this ambiguity ArchUnit follows the logic described in the Java Reflection API, i.e.interface A { void target(); } interface B { void target(); } interface C extends A, B {} class X { C c; // ... void origin() { c.target(); } }
Class.getMethod(String, Class[])
.- Overrides:
resolveMember
in classAccessTarget.CodeUnitAccessTarget
- Returns:
- Matching method if imported,
Optional.empty()
otherwise - See Also:
-
getDescription
-