Package com.tngtech.archunit.core.domain
Class JavaMember
- java.lang.Object
-
- com.tngtech.archunit.core.domain.JavaMember
-
- All Implemented Interfaces:
CanBeAnnotated
,HasAnnotations
,HasDescriptor
,HasModifiers
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
- Direct Known Subclasses:
JavaCodeUnit
,JavaField
public abstract class JavaMember extends java.lang.Object implements HasName.AndFullName, HasDescriptor, HasAnnotations, HasModifiers, HasOwner<JavaClass>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaMember.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.Functions
-
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasOwner
HasOwner.Functions
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.Set<? extends JavaAccess<?>>
getAccessesToSelf()
<A extends java.lang.annotation.Annotation>
AgetAnnotationOfType(java.lang.Class<A> type)
Returns theAnnotation
of this member of the givenAnnotation
type.JavaAnnotation
getAnnotationOfType(java.lang.String typeName)
java.util.Set<JavaAnnotation>
getAnnotations()
java.lang.String
getDescriptor()
java.util.Set<JavaModifier>
getModifiers()
java.lang.String
getName()
JavaClass
getOwner()
boolean
isAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
boolean
isAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
boolean
isAnnotatedWith(java.lang.String typeName)
boolean
isMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
boolean
isMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
boolean
isMetaAnnotatedWith(java.lang.String typeName)
abstract java.lang.reflect.Member
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.java.lang.String
toString()
<A extends java.lang.annotation.Annotation>
Optional<A>tryGetAnnotationOfType(java.lang.Class<A> type)
Optional<JavaAnnotation>
tryGetAnnotationOfType(java.lang.String typeName)
-
Methods inherited from interface com.tngtech.archunit.core.domain.properties.HasName.AndFullName
getFullName
-
-
-
-
Method Detail
-
getAnnotations
public java.util.Set<JavaAnnotation> getAnnotations()
- Specified by:
getAnnotations
in interfaceHasAnnotations
-
getAnnotationOfType
public <A extends java.lang.annotation.Annotation> A getAnnotationOfType(java.lang.Class<A> type)
Returns theAnnotation
of this member of the givenAnnotation
type.- Specified by:
getAnnotationOfType
in interfaceHasAnnotations
- Throws:
java.lang.IllegalArgumentException
- if there is no annotation of the respective reflection type
-
getAnnotationOfType
public JavaAnnotation getAnnotationOfType(java.lang.String typeName)
- Specified by:
getAnnotationOfType
in interfaceHasAnnotations
-
tryGetAnnotationOfType
public <A extends java.lang.annotation.Annotation> Optional<A> tryGetAnnotationOfType(java.lang.Class<A> type)
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations
-
tryGetAnnotationOfType
public Optional<JavaAnnotation> tryGetAnnotationOfType(java.lang.String typeName)
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations
-
isAnnotatedWith
public boolean isAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isAnnotatedWith
public boolean isAnnotatedWith(java.lang.String typeName)
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isAnnotatedWith
public boolean isAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
public boolean isMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
public boolean isMetaAnnotatedWith(java.lang.String typeName)
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
public boolean isMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
getModifiers
public java.util.Set<JavaModifier> getModifiers()
- Specified by:
getModifiers
in interfaceHasModifiers
-
getDescriptor
@Internal public java.lang.String getDescriptor()
- Specified by:
getDescriptor
in interfaceHasDescriptor
-
getAccessesToSelf
@PublicAPI(usage=ACCESS) public abstract java.util.Set<? extends JavaAccess<?>> getAccessesToSelf()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
reflect
@PublicAPI(usage=ACCESS) public abstract java.lang.reflect.Member 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.- Returns:
- The
Member
equivalent to thisJavaMember
-
-