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, isMetaAnnotatedWith
Methods inherited from interface com.tngtech.archunit.base.HasDescription
getDescription
-
Method Details
-
getAnnotations
-
getAnnotationOfType
- Type Parameters:
A
- The type of theAnnotation
to retrieve- Parameters:
type
- TheClass
of theAnnotation
to retrieve.- Returns:
- The
Annotation
of the given type. Will throw anIllegalArgumentException
if no matchingAnnotation
is present. - See Also:
-
getAnnotationOfType
- 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
- Type Parameters:
A
- The type of theAnnotation
to retrieve- Parameters:
type
- TheClass
of theAnnotation
to retrieve.- Returns:
- The
Annotation
of the given type orOptional.empty()
if there is noAnnotation
with 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 theAnnotation
type to retrieve.- Returns:
- The
JavaAnnotation
matching the given type orOptional.empty()
if there is noAnnotation
with the respective annotation type. - See Also:
-