public interface Annotated
Represents a Java program element that can be annotated.
AnnotatedElement
Modifier and Type | Method and Description |
---|---|
<T extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<T> annotationType)
Get program element annotation of a certain annotation type.
|
java.util.Set<java.lang.annotation.Annotation> |
getAnnotations()
Get all annotations of the program element.
|
<T extends java.lang.annotation.Annotation> |
getAnnotations(java.lang.Class<T> annotationType)
Get program element annotations of a certain annotation type.
|
java.lang.reflect.Type |
getBaseType()
Get the type of the annotated program element.
|
java.util.Set<java.lang.reflect.Type> |
getTypeClosure()
Get all types to which the base type should be considered assignable.
|
boolean |
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determine if the program element has an annotation of a certain annotation type.
|
java.lang.reflect.Type getBaseType()
Get the type of the annotated program element.
java.util.Set<java.lang.reflect.Type> getTypeClosure()
Get all types to which the base type should be considered assignable.
<T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationType)
Get program element annotation of a certain annotation type.
The behavior of this method is intended to be the same behavior as AnnotatedElement.getAnnotation(Class)
,
where repeatable annotations are not supported.
T
- the type of the annotationannotationType
- the class of the annotation type<T extends java.lang.annotation.Annotation> java.util.Set<T> getAnnotations(java.lang.Class<T> annotationType)
Get program element annotations of a certain annotation type.
This method returns back all annotations, including repeatable annotations of this type.
The behavior of this method is intended to be the same behavior as AnnotatedElement.getAnnotationsByType(Class)
,
where repeatable annotations are supported.
T
- the type of the annotationannotationType
- the class of the annotation typejava.util.Set<java.lang.annotation.Annotation> getAnnotations()
Get all annotations of the program element.
boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determine if the program element has an annotation of a certain annotation type.
The behavior of this method is similar to AnnotatedElement.isAnnotationPresent(Class)
for the underlying
program element.
annotationType
- the annotation type to check fortrue
if the program element has an annotation of the given annotation type, or false
otherwise