-
- All Known Subinterfaces:
- AnnotatedCallable<X>, AnnotatedConstructor<X>, AnnotatedField<X>, AnnotatedMember<X>, AnnotatedMethod<X>, AnnotatedParameter<X>, AnnotatedType<X>
public interface Annotated
Represents a Java program element that can be annotated.
- Author:
- Gavin King, Pete Muir, Clint Popetz
- See Also:
AnnotatedElement
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description <T extends Annotation>
TgetAnnotation(Class<T> annotationType)
Get program element annotation of a certain annotation type.Set<Annotation>
getAnnotations()
Get all annotations of the program element.Type
getBaseType()
Get the type of the annotated program element.Set<Type>
getTypeClosure()
Get all types to which the base type should be considered assignable.boolean
isAnnotationPresent(Class<? extends Annotation> annotationType)
Determine if the program element has an annotation of a certain annotation type.
-
-
-
Method Detail
-
getBaseType
Type getBaseType()
Get the type of the annotated program element.
- Returns:
- the type of the annotated program element
-
getTypeClosure
Set<Type> getTypeClosure()
Get all types to which the base type should be considered assignable.
- Returns:
- a set of all types to which the base type should be considered assignable
-
getAnnotation
<T extends Annotation> T getAnnotation(Class<T> annotationType)
Get program element annotation of a certain annotation type.
- Type Parameters:
T
- the type of the annotation- Parameters:
annotationType
- the class of the annotation type- Returns:
- the program element annotation of the given annotation type, or a null value
-
getAnnotations
Set<Annotation> getAnnotations()
Get all annotations of the program element.
- Returns:
- all annotations of the program element, or an empty set if no annotations are present
-
isAnnotationPresent
boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
Determine if the program element has an annotation of a certain annotation type.
- Parameters:
annotationType
- the annotation type to check for- Returns:
- true if the program element has an annotation of the given annotation type, or false otherwise
-
-
Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/enterprise/inject/spi/annotated.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.