Package com.tngtech.archunit.core.domain
Class AccessTarget.MethodCallTarget
- java.lang.Object
-
- com.tngtech.archunit.core.domain.AccessTarget
-
- com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget
-
- com.tngtech.archunit.core.domain.AccessTarget.MethodCallTarget
-
- All Implemented Interfaces:
CanBeAnnotated
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
,HasParameterTypes
,HasReturnType
,HasThrowsClause<AccessTarget.CodeUnitCallTarget>
- Enclosing class:
- AccessTarget
public static final class AccessTarget.MethodCallTarget extends AccessTarget.CodeUnitCallTarget
Represents aAccessTarget.CodeUnitCallTarget
where the target is a method. For further elaboration about the necessity to distinguishMethodCallTarget
fromJavaMethod
, refer to the documentation atAccessTarget
and in particular the documentation atresolve()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AccessTarget.MethodCallTarget.Functions
-
Nested classes/interfaces inherited from class com.tngtech.archunit.core.domain.AccessTarget
AccessTarget.CodeUnitCallTarget, AccessTarget.ConstructorCallTarget, AccessTarget.FieldAccessTarget, AccessTarget.MethodCallTarget, 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
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<JavaMethod>
resolve()
Attempts to resolve imported methods that match this target.-
Methods inherited from class com.tngtech.archunit.core.domain.AccessTarget.CodeUnitCallTarget
getParameters, getRawParameterTypes, getRawReturnType, getReturnType, getThrowsClause
-
Methods inherited from class com.tngtech.archunit.core.domain.AccessTarget
equals, getFullName, getName, getOwner, hashCode, isAnnotatedWith, isAnnotatedWith, isAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, toString
-
-
-
-
Method Detail
-
resolve
@PublicAPI(usage=ACCESS) public java.util.Set<JavaMethod> resolve()
Attempts to resolve imported methods that match this target. Note that while usually there is one unique target (if imported), it is possible that the call is ambiguous. For example consider
While, for any concrete implementation, the compiler will naturally resolve one concrete target to link to, and thus at runtime the called target ist clear, from an analytical point of view the relevant target can't be uniquely identified here. To sum up, the result can beinterface A { void target(); } interface B { void target(); } interface C extends A, B {} class X { C c; // ... void origin() { c.target(); } }
- empty - if no imported method matches the target
- a single method - if the method was imported and can uniquely be identified
- several methods - in scenarios where there is no unique method that matches the target
void target()
itself.- Specified by:
resolve
in classAccessTarget.CodeUnitCallTarget
- Returns:
- Set of matching methods, usually a single target
- See Also:
AccessTarget.ConstructorCallTarget.resolveConstructor()
,resolve()
-
-