Package com.tngtech.archunit.core.domain
Class JavaMethod
- java.lang.Object
-
- com.tngtech.archunit.core.domain.JavaMember
-
- com.tngtech.archunit.core.domain.JavaCodeUnit
-
- com.tngtech.archunit.core.domain.JavaMethod
-
- All Implemented Interfaces:
HasDescription
,CanBeAnnotated
,HasAnnotations<JavaMember>
,HasDescriptor
,HasModifiers
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
,HasParameterTypes
,HasReturnType
,HasSourceCodeLocation
,HasThrowsClause<JavaCodeUnit>
public class JavaMethod extends JavaCodeUnit
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tngtech.archunit.core.domain.JavaCodeUnit
JavaCodeUnit.Functions, JavaCodeUnit.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<JavaMethodCall>
getAccessesToSelf()
JavaAnnotation<JavaMethod>
getAnnotationOfType(java.lang.String typeName)
java.util.Set<JavaAnnotation<JavaMethod>>
getAnnotations()
java.util.Set<JavaMethodCall>
getCallsOfSelf()
Optional<java.lang.Object>
getDefaultValue()
Returns the default value of this annotation method, if the method is an annotation method and has a declared default.java.lang.String
getDescription()
ThrowsClause<JavaMethod>
getThrowsClause()
java.lang.reflect.Method
reflect()
Resolves the respectiveMember
from the classpath.
NOTE: This method will throw an exception, if the owningClass
or any of its dependencies can't be found on the classpath.Optional<JavaAnnotation<JavaMethod>>
tryGetAnnotationOfType(java.lang.String typeName)
-
Methods inherited from class com.tngtech.archunit.core.domain.JavaCodeUnit
getAccessesFromSelf, getCallsFromSelf, getConstructorCallsFromSelf, getExceptionTypes, getFieldAccesses, getFullName, getMethodCallsFromSelf, getRawParameterTypes, getRawReturnType, isConstructor
-
Methods inherited from class com.tngtech.archunit.core.domain.JavaMember
getAnnotationOfType, getDescriptor, getModifiers, getName, getOwner, getSourceCodeLocation, isAnnotatedWith, isAnnotatedWith, isAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, toString, tryGetAnnotationOfType
-
-
-
-
Method Detail
-
getThrowsClause
@PublicAPI(usage=ACCESS) public ThrowsClause<JavaMethod> getThrowsClause()
- Specified by:
getThrowsClause
in interfaceHasThrowsClause<JavaCodeUnit>
- Specified by:
getThrowsClause
in classJavaCodeUnit
-
getDefaultValue
@PublicAPI(usage=ACCESS) public Optional<java.lang.Object> getDefaultValue()
Returns the default value of this annotation method, if the method is an annotation method and has a declared default. It's analogue toMethod.getDefaultValue()
, but returns Optional.absent() instead of null.- Returns:
- Optional.of(defaultValue) if applicable, otherwise Optional.absent()
-
getCallsOfSelf
@PublicAPI(usage=ACCESS) public java.util.Set<JavaMethodCall> getCallsOfSelf()
-
getAccessesToSelf
@PublicAPI(usage=ACCESS) public java.util.Set<JavaMethodCall> getAccessesToSelf()
- Specified by:
getAccessesToSelf
in classJavaMember
-
getAnnotations
public java.util.Set<JavaAnnotation<JavaMethod>> getAnnotations()
- Specified by:
getAnnotations
in interfaceHasAnnotations<JavaMember>
- Overrides:
getAnnotations
in classJavaCodeUnit
-
getAnnotationOfType
public JavaAnnotation<JavaMethod> getAnnotationOfType(java.lang.String typeName)
- Specified by:
getAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Overrides:
getAnnotationOfType
in classJavaCodeUnit
-
tryGetAnnotationOfType
public Optional<JavaAnnotation<JavaMethod>> tryGetAnnotationOfType(java.lang.String typeName)
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Overrides:
tryGetAnnotationOfType
in classJavaCodeUnit
-
reflect
@PublicAPI(usage=ACCESS) public java.lang.reflect.Method reflect()
Description copied from class:JavaMember
Resolves the respectiveMember
from the classpath.
NOTE: This method will throw an exception, if the owningClass
or any of its dependencies can't be found on the classpath.- Specified by:
reflect
in classJavaMember
- Returns:
- The
Member
equivalent to thisJavaMember
-
getDescription
@PublicAPI(usage=ACCESS) public java.lang.String getDescription()
-
-