Interface HasAnnotations<SELF extends HasAnnotations<SELF>>
- All Superinterfaces:
CanBeAnnotated,HasDescription
- All Known Implementing Classes:
JavaClass,JavaCodeUnit,JavaConstructor,JavaField,JavaMember,JavaMethod,JavaPackage,JavaParameter,JavaStaticInitializer
@PublicAPI(usage=ACCESS)
public interface HasAnnotations<SELF extends HasAnnotations<SELF>>
extends CanBeAnnotated, HasDescription
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.CanBeAnnotated
CanBeAnnotated.Predicates, CanBeAnnotated.Utils -
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
AgetAnnotationOfType(Class<A> type) JavaAnnotation<? extends SELF>getAnnotationOfType(String typeName) Set<? extends JavaAnnotation<? extends SELF>><A extends Annotation>
Optional<A>tryGetAnnotationOfType(Class<A> type) Optional<? extends JavaAnnotation<? extends SELF>>tryGetAnnotationOfType(String typeName) Methods inherited from interface com.tngtech.archunit.core.domain.properties.CanBeAnnotated
isAnnotatedWith, isAnnotatedWith, isAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWithMethods inherited from interface com.tngtech.archunit.base.HasDescription
getDescription
-
Method Details
-
getAnnotations
-
getAnnotationOfType
- Type Parameters:
A- The type of theAnnotationto retrieve- Parameters:
type- TheClassof theAnnotationto retrieve.- Returns:
- The
Annotationof the given type. Will throw anIllegalArgumentExceptionif no matchingAnnotationis present. - See Also:
-
getAnnotationOfType
- 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
- Type Parameters:
A- The type of theAnnotationto retrieve- Parameters:
type- TheClassof theAnnotationto retrieve.- Returns:
- The
Annotationof the given type orOptional.empty()if there is noAnnotationwith the respective annotation type. - See Also:
-
tryGetAnnotationOfType
@PublicAPI(usage=ACCESS) Optional<? extends JavaAnnotation<? extends SELF>> tryGetAnnotationOfType(String typeName) - 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:
-