Package com.tngtech.archunit.core.domain
Class JavaField
java.lang.Object
com.tngtech.archunit.core.domain.JavaMember
com.tngtech.archunit.core.domain.JavaField
- All Implemented Interfaces:
HasDescription
,CanBeAnnotated
,HasAnnotations<JavaMember>
,HasDescriptor
,HasModifiers
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
,HasSourceCodeLocation
,HasType
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tngtech.archunit.core.domain.JavaMember
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.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
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasType
HasType.Functions, HasType.Predicates
-
Method Summary
Modifier and TypeMethodDescriptiongetAnnotationOfType
(String typeName) getType()
Note: This is still work in progress and thus does not support generic types at the moment.reflect()
tryGetAnnotationOfType
(String typeName) Methods inherited from class com.tngtech.archunit.core.domain.JavaMember
getAnnotationOfType, getDescriptor, getModifiers, getName, getOwner, getReverseDependencies, getSourceCodeLocation, isAnnotatedWith, isAnnotatedWith, isAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, toString, tryGetAnnotationOfType
-
Method Details
-
getFullName
- Specified by:
getFullName
in interfaceHasName.AndFullName
- Returns:
- The full name of this
JavaField
, i.e. a string containing${declaringClass}.${name}
-
getType
Note: This is still work in progress and thus does not support generic types at the moment. In the future the result can possibly also be aJavaParameterizedType
orJavaTypeVariable
-
getRawType
- Specified by:
getRawType
in interfaceHasType
-
getAccessesToSelf
- Specified by:
getAccessesToSelf
in classJavaMember
-
getAnnotations
- Specified by:
getAnnotations
in interfaceHasAnnotations<JavaMember>
- Overrides:
getAnnotations
in classJavaMember
-
getAnnotationOfType
- Specified by:
getAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Overrides:
getAnnotationOfType
in classJavaMember
- Parameters:
typeName
- The fully qualified class name of theAnnotation
type to retrieve.- Returns:
- The
JavaAnnotation
matching the given type. Will throw anIllegalArgumentException
if no matchingAnnotation
is present. - See Also:
-
tryGetAnnotationOfType
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Overrides:
tryGetAnnotationOfType
in classJavaMember
- Parameters:
typeName
- The fully qualified class name of theAnnotation
type to retrieve.- Returns:
- The
JavaAnnotation
matching the given type orOptional.empty()
if there is noAnnotation
with the respective annotation type. - See Also:
-
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
- Specified by:
getDescription
in interfaceHasDescription
-