Package com.tngtech.archunit.core.domain
Class JavaMember
- java.lang.Object
-
- com.tngtech.archunit.core.domain.JavaMember
-
- All Implemented Interfaces:
HasDescription,CanBeAnnotated,HasAnnotations,HasDescriptor,HasModifiers,HasName,HasName.AndFullName,HasOwner<JavaClass>,HasSourceCodeLocation
- Direct Known Subclasses:
JavaCodeUnit,JavaField
public abstract class JavaMember extends java.lang.Object implements HasName.AndFullName, HasDescriptor, HasAnnotations, HasModifiers, HasOwner<JavaClass>, HasDescription, HasSourceCodeLocation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJavaMember.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.HasName.AndFullName
HasName.AndFullName.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 theAnnotationof this member of the givenAnnotationtype.JavaAnnotationgetAnnotationOfType(java.lang.String typeName)java.util.Set<JavaAnnotation>getAnnotations()java.lang.StringgetDescriptor()java.util.Set<JavaModifier>getModifiers()java.lang.StringgetName()JavaClassgetOwner()SourceCodeLocationgetSourceCodeLocation()booleanisAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)booleanisAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)booleanisAnnotatedWith(java.lang.String typeName)booleanisMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)booleanisMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)booleanisMetaAnnotatedWith(java.lang.String typeName)abstract java.lang.reflect.Memberreflect()Resolves the respectiveMemberfrom the classpath.
NOTE: This method will throw an exception, if the owningClassor any of its dependencies can't be found on the classpath.java.lang.StringtoString()<A extends java.lang.annotation.Annotation>
Optional<A>tryGetAnnotationOfType(java.lang.Class<A> type)Optional<JavaAnnotation>tryGetAnnotationOfType(java.lang.String typeName)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tngtech.archunit.base.HasDescription
getDescription
-
Methods inherited from interface com.tngtech.archunit.core.domain.properties.HasName.AndFullName
getFullName
-
-
-
-
Method Detail
-
getAnnotations
@PublicAPI(usage=ACCESS) public java.util.Set<JavaAnnotation> getAnnotations()
- Specified by:
getAnnotationsin interfaceHasAnnotations
-
getAnnotationOfType
@PublicAPI(usage=ACCESS) public <A extends java.lang.annotation.Annotation> A getAnnotationOfType(java.lang.Class<A> type)
Returns theAnnotationof this member of the givenAnnotationtype.- Specified by:
getAnnotationOfTypein interfaceHasAnnotations- Throws:
java.lang.IllegalArgumentException- if there is no annotation of the respective reflection type
-
getAnnotationOfType
@PublicAPI(usage=ACCESS) public JavaAnnotation getAnnotationOfType(java.lang.String typeName)
- Specified by:
getAnnotationOfTypein interfaceHasAnnotations
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) public <A extends java.lang.annotation.Annotation> Optional<A> tryGetAnnotationOfType(java.lang.Class<A> type)
- Specified by:
tryGetAnnotationOfTypein interfaceHasAnnotations
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) public Optional<JavaAnnotation> tryGetAnnotationOfType(java.lang.String typeName)
- Specified by:
tryGetAnnotationOfTypein interfaceHasAnnotations
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
- Specified by:
isAnnotatedWithin interfaceCanBeAnnotated
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(java.lang.String typeName)
- Specified by:
isAnnotatedWithin interfaceCanBeAnnotated
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
- Specified by:
isAnnotatedWithin interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
- Specified by:
isMetaAnnotatedWithin interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(java.lang.String typeName)
- Specified by:
isMetaAnnotatedWithin interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
- Specified by:
isMetaAnnotatedWithin interfaceCanBeAnnotated
-
getOwner
@PublicAPI(usage=ACCESS) public JavaClass getOwner()
-
getSourceCodeLocation
@PublicAPI(usage=ACCESS) public SourceCodeLocation getSourceCodeLocation()
- Specified by:
getSourceCodeLocationin interfaceHasSourceCodeLocation- Returns:
- The
SourceCodeLocationof this object, i.e. how to locate the respective object within the set of source files.
-
getModifiers
@PublicAPI(usage=ACCESS) public java.util.Set<JavaModifier> getModifiers()
- Specified by:
getModifiersin interfaceHasModifiers
-
getName
@PublicAPI(usage=ACCESS) public java.lang.String getName()
-
getDescriptor
@Internal public java.lang.String getDescriptor()
- Specified by:
getDescriptorin interfaceHasDescriptor
-
getAccessesToSelf
@PublicAPI(usage=ACCESS) public abstract java.util.Set<? extends JavaAccess<?>> getAccessesToSelf()
-
reflect
@PublicAPI(usage=ACCESS) public abstract java.lang.reflect.Member reflect()
Resolves the respectiveMemberfrom the classpath.
NOTE: This method will throw an exception, if the owningClassor any of its dependencies can't be found on the classpath.- Returns:
- The
Memberequivalent to thisJavaMember
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-