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 java.lang.Object implements HasName.AndFullName, HasDescriptor, HasAnnotations<JavaMember>, HasModifiers, HasOwner<JavaClass>, HasSourceCodeLocation
-
-
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
-
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 theAnnotation
of this member of the givenAnnotation
type.JavaAnnotation<? extends JavaMember>
getAnnotationOfType(java.lang.String typeName)
java.util.Set<? extends JavaAnnotation<? extends JavaMember>>
getAnnotations()
java.lang.String
getDescriptor()
java.util.Set<JavaModifier>
getModifiers()
java.lang.String
getName()
JavaClass
getOwner()
protected com.tngtech.archunit.core.domain.ReverseDependencies
getReverseDependencies()
SourceCodeLocation
getSourceCodeLocation()
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<? extends JavaAnnotation<? extends JavaMember>>
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<? extends JavaAnnotation<? extends JavaMember>> getAnnotations()
- Specified by:
getAnnotations
in interfaceHasAnnotations<JavaMember>
-
getAnnotationOfType
@PublicAPI(usage=ACCESS) 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<JavaMember>
- Throws:
java.lang.IllegalArgumentException
- if there is no annotation of the respective reflection type
-
getAnnotationOfType
@PublicAPI(usage=ACCESS) public JavaAnnotation<? extends JavaMember> getAnnotationOfType(java.lang.String typeName)
- Specified by:
getAnnotationOfType
in interfaceHasAnnotations<JavaMember>
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) public <A extends java.lang.annotation.Annotation> Optional<A> tryGetAnnotationOfType(java.lang.Class<A> type)
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) public Optional<? extends JavaAnnotation<? extends JavaMember>> tryGetAnnotationOfType(java.lang.String typeName)
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(java.lang.String typeName)
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate)
- Specified by:
isAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> type)
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(java.lang.String typeName)
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
isMetaAnnotatedWith
@PublicAPI(usage=ACCESS) public boolean isMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate)
- Specified by:
isMetaAnnotatedWith
in interfaceCanBeAnnotated
-
getOwner
@PublicAPI(usage=ACCESS) public JavaClass getOwner()
-
getSourceCodeLocation
@PublicAPI(usage=ACCESS) public SourceCodeLocation 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
@PublicAPI(usage=ACCESS) public java.util.Set<JavaModifier> getModifiers()
- Specified by:
getModifiers
in interfaceHasModifiers
-
getName
@PublicAPI(usage=ACCESS) public java.lang.String getName()
-
getDescriptor
@Internal public java.lang.String getDescriptor()
- Specified by:
getDescriptor
in 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 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-