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.PredicatesNested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.CanBeAnnotated
CanBeAnnotated.UtilsNested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasName
HasName.AndFullName, HasName.UtilsNested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasName.AndFullName
HasName.AndFullName.FunctionsNested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasOwner
HasOwner.FunctionsNested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasType
HasType.Functions, HasType.Predicates -
Method Summary
Modifier and TypeMethodDescriptionSimilar toJavaType.getAllInvolvedRawTypes(), this method returns all raw types involved in thismember'ssignature.getAnnotationOfType(String typeName) getType()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:
getFullNamein interfaceHasName.AndFullName- Returns:
- The full name of this
JavaField, i.e. a string containing${declaringClass}.${name}
-
getType
-
getRawType
- Specified by:
getRawTypein interfaceHasType- Returns:
- The raw type of this object. This is effectively the same as calling
HasType.getType().toErasure(). E.g. given aJavaParameterizedTypejava.util.List<String>the raw type (i.e. type erasure) would be theJavaClassjava.util.List. - See Also:
-
getAllInvolvedRawTypes
Description copied from class:JavaMemberSimilar toJavaType.getAllInvolvedRawTypes(), this method returns all raw types involved in thismember'ssignature. For more concrete details refer togetAllInvolvedRawTypes()andJavaCodeUnit.getAllInvolvedRawTypes().- Specified by:
getAllInvolvedRawTypesin classJavaMember- Returns:
- All raw types involved in this field's signature, which is equivalent to
getType().getAllInvolvedRawTypes().
-
getAccessesToSelf
- Specified by:
getAccessesToSelfin classJavaMember
-
getAnnotations
- Specified by:
getAnnotationsin interfaceHasAnnotations<JavaMember>- Overrides:
getAnnotationsin classJavaMember
-
getAnnotationOfType
- Specified by:
getAnnotationOfTypein interfaceHasAnnotations<JavaMember>- Overrides:
getAnnotationOfTypein classJavaMember- Parameters:
typeName- The fully qualified class name of theAnnotationtype to retrieve.- Returns:
- The
JavaAnnotationmatching the given type. Will throw anIllegalArgumentExceptionif no matchingAnnotationis present. - See Also:
-
tryGetAnnotationOfType
- Specified by:
tryGetAnnotationOfTypein interfaceHasAnnotations<JavaMember>- Overrides:
tryGetAnnotationOfTypein classJavaMember- Parameters:
typeName- The fully qualified class name of theAnnotationtype to retrieve.- Returns:
- The
JavaAnnotationmatching the given type orOptional.empty()if there is noAnnotationwith the respective annotation type. - See Also:
-
reflect
Description copied from class:JavaMemberResolves 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.- Specified by:
reflectin classJavaMember- Returns:
- The
Memberequivalent to thisJavaMember
-
getDescription
- Specified by:
getDescriptionin interfaceHasDescription
-