Package com.tngtech.archunit.core.domain
Class JavaMember
java.lang.Object
com.tngtech.archunit.core.domain.JavaMember
- All Implemented Interfaces:
HasDescription
,CanBeAnnotated
,HasAnnotations<JavaMember>
,HasDescriptor
,HasModifiers
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
,HasSourceCodeLocation
- Direct Known Subclasses:
JavaCodeUnit
,JavaField
public abstract class JavaMember
extends Object
implements HasName.AndFullName, HasDescriptor, HasAnnotations<JavaMember>, HasModifiers, HasOwner<JavaClass>, HasSourceCodeLocation
-
Nested Class Summary
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.HasName.AndFullName
HasName.AndFullName.Functions
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasOwner
HasOwner.Functions
-
Method Summary
Modifier and TypeMethodDescriptionabstract Set<? extends JavaAccess<?>>
<A extends Annotation>
AgetAnnotationOfType
(Class<A> type) Returns theAnnotation
of this member of the givenAnnotation
type.JavaAnnotation<? extends JavaMember>
getAnnotationOfType
(String typeName) Set<? extends JavaAnnotation<? extends JavaMember>>
getName()
getOwner()
protected com.tngtech.archunit.core.domain.ReverseDependencies
boolean
isAnnotatedWith
(DescribedPredicate<? super JavaAnnotation<?>> predicate) boolean
isAnnotatedWith
(Class<? extends Annotation> type) boolean
isAnnotatedWith
(String typeName) boolean
isMetaAnnotatedWith
(DescribedPredicate<? super JavaAnnotation<?>> predicate) boolean
isMetaAnnotatedWith
(Class<? extends Annotation> type) boolean
isMetaAnnotatedWith
(String typeName) abstract Member
reflect()
toString()
<A extends Annotation>
Optional<A>tryGetAnnotationOfType
(Class<A> type) Optional<? extends JavaAnnotation<? extends JavaMember>>
tryGetAnnotationOfType
(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 Details
-
getAnnotations
@PublicAPI(usage=ACCESS) public Set<? extends JavaAnnotation<? extends JavaMember>> getAnnotations()- Specified by:
getAnnotations
in interfaceHasAnnotations<JavaMember>
-
getAnnotationOfType
Returns theAnnotation
of this member of the givenAnnotation
type.- Specified by:
getAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Throws:
IllegalArgumentException
- if there is no annotation of the respective reflection type
-
getAnnotationOfType
@PublicAPI(usage=ACCESS) public JavaAnnotation<? extends JavaMember> getAnnotationOfType(String typeName) - Specified by:
getAnnotationOfType
in interfaceHasAnnotations<JavaMember>
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) public <A extends Annotation> Optional<A> tryGetAnnotationOfType(Class<A> type) - Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) public Optional<? extends JavaAnnotation<? extends JavaMember>> tryGetAnnotationOfType(String typeName) - Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
-
isAnnotatedWith
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isAnnotatedWith
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate) - Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate) - Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
getOwner
-
getSourceCodeLocation
- Specified by:
getSourceCodeLocation
in interfaceHasSourceCodeLocation
- Returns:
- The
SourceCodeLocation
of this object, i.e. how to locate the respective object within the set of source files.
-
getModifiers
- Specified by:
getModifiers
in interfaceHasModifiers
-
getName
-
getDescriptor
- Specified by:
getDescriptor
in interfaceHasDescriptor
-
getAccessesToSelf
-
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
-
getReverseDependencies
protected com.tngtech.archunit.core.domain.ReverseDependencies getReverseDependencies() -
toString
-