Overall, two distinct kinds of annotation targets exist: declarations and types.
To refer to declarations only, the Declaration interface may be used.
Declaration, TypeTarget
| Modifier and Type | Class and Description |
|---|---|
| public static enum | AnnotationTarget.Kind
Specifies the kind of object a target represents. |
| Modifier and Type | Method and Description |
|---|---|
| public AnnotationInstance | Returns: the annotation instance, ornull if not foundname of the annotation type to look for, must not be name)nullReturns the annotation instance with given name declared on this annotation target or any of its nested annotation targets. |
| public default AnnotationInstance | Returns: the annotation instance, ornull if not foundname of the annotation type to look for, must not be name)nullReturns the annotation instance with given name declared on this annotation target or any of its nested annotation targets. |
| public default AnnotationInstance | Returns: the annotation instance, ornull if not foundthe annotation type to look for, must not be clazz)nullReturns the annotation instance of given type declared on this annotation target or any of its nested annotation targets. |
| public Collection | Returns: immutable collection of annotation instances, nevernullname of the annotation type, must not be name)nullReturns the annotation instances with given name declared on this annotation target and nested annotation targets. |
| public default Collection | Returns: immutable collection of annotation instances, nevernullname of the annotation type, must not be name)nullReturns the annotation instances with given name declared on this annotation target and nested annotation targets. |
| public default Collection | Returns: immutable collection of annotation instances, nevernullthe annotation type, must not be clazz)nullReturns the annotation instances of given type declared on this annotation target and nested annotation targets. |
| public Collection | Returns: immutable collection of annotation instances, nevernullReturns the annotation instances declared on this annotation target and nested annotation targets. |
| public Collection | Returns: immutable collection of annotation instances, nevernullname of the annotation type, must not be name, IndexView nullindex used to obtain the annotation type, must not be index)nullReturns the annotation instances with given name declared on this annotation target and nested annotation targets. |
| public default Collection | Returns: immutable collection of annotation instances, nevernullname of the annotation type, must not be name, IndexView nullindex used to obtain the annotation type, must not be index)nullReturns the annotation instances with given name declared on this annotation target and nested annotation targets. |
| public default Collection | Returns: immutable collection of annotation instances, nevernullthe annotation type, must not be clazz, IndexView nullindex used to obtain the annotation type, must not be index)nullReturns the annotation instances of given type declared on this annotation target and nested annotation targets. |
| public ClassInfo | Returns: this instance cast to a classCasts and returns this target as a |
| public Declaration | Returns: this instance cast to a declarationCasts and returns this annotation target as a |
| public FieldInfo | Returns: this instance cast to a fieldCasts and returns this target as a |
| public MethodInfo | Returns: this instance cast to a methodCasts and returns this target as a |
| public MethodParameterInfo | Returns: this instance cast to a method parameterCasts and returns this target as a |
| public RecordComponentInfo | Returns: this instance cast to a record componentCasts and returns this target as a |
| public TypeTarget | Returns: this instance cast to a type targetCasts and returns this target as a |
| public AnnotationInstance | Returns: the annotation instance, ornull if not foundname of the annotation type to look for, must not be name)nullReturns the annotation instance with given name declared on this annotation target. |
| public default AnnotationInstance | Returns: the annotation instance, ornull if not foundname of the annotation type to look for, must not be name)nullReturns the annotation instance with given name declared on this annotation target. |
| public default AnnotationInstance | Returns: the annotation instance, ornull if not foundthe annotation type to look for, must not be clazz)nullReturns the annotation instance of given type declared on this annotation target. |
| public Collection | Returns: immutable collection of annotation instances, nevernullReturns the annotation instances declared on this annotation target. |
| public Collection | Returns: immutable collection of annotation instances, nevernullname of the annotation type, must not be name, IndexView nullindex used to obtain the annotation type, must not be index)nullReturns the annotation instances with given name declared on this annotation target. |
| public default Collection | Returns: immutable collection of annotation instances, nevernullname of the annotation type, must not be name, IndexView nullindex used to obtain the annotation type, must not be index)nullReturns the annotation instances with given name declared on this annotation target. |
| public default Collection | Returns: immutable collection of annotation instances, nevernullthe annotation type, must not be clazz, IndexView nullindex used to obtain the annotation type, must not be index)nullReturns the annotation instances of given type declared on this annotation target. |
| public boolean | Returns: true if the annotation is present, false otherwisename of the annotation type to look for, must not be name)nullReturns whether an annotation instance with given name is declared on this annotation target or any of its nested annotation targets. |
| public default boolean | Returns: true if the annotation is present, false otherwisename of the annotation type to look for, must not be name)nullReturns whether an annotation instance with given name is declared on this annotation target or any of its nested annotation targets. |
| public default boolean | Returns: true if the annotation is present, false otherwisethe annotation type to look for, must not be clazz)nullReturns whether an annotation instance of given type is declared on this annotation target or any of its nested annotation targets. |
| public boolean | Returns: true if the annotation is present, false otherwisename of the annotation type to look for, must not be name)nullReturns whether an annotation instance with given name is declared on this annotation target. |
| public default boolean | Returns: true if the annotation is present, false otherwisename of the annotation type to look for, must not be name)nullReturns whether an annotation instance with given name is declared on this annotation target. |
| public default boolean | Returns: true if the annotation is present, false otherwisethe annotation type to look for, must not be clazz)nullReturns whether an annotation instance of given type is declared on this annotation target. |
| public boolean | Returns: whether this annotation target is a declarationReturns whether this annotation target is a declaration. |
| public AnnotationTarget. |
| annotation | back to summary |
|---|---|
| public AnnotationInstance annotation(DotName name) Returns the annotation instance with given name declared on this annotation target or any of its nested
annotation targets. The
In case an annotation with given name occurs more than once, the result of this method is not deterministic.
For such situations,
| |
| annotation | back to summary |
|---|---|
| public default AnnotationInstance annotation(String name) Returns the annotation instance with given name declared on this annotation target or any of its nested
annotation targets. The
In case an annotation with given name occurs more than once, the result of this method is not deterministic.
For such situations,
| |
| annotation | back to summary |
|---|---|
| public default AnnotationInstance annotation(Class<? extends Annotation> clazz) Returns the annotation instance of given type declared on this annotation target or any of its nested
annotation targets. The
In case an annotation with given name occurs more than once, the result of this method is not deterministic.
For such situations,
| |
| annotations | back to summary |
|---|---|
| public Collection Returns the annotation instances with given name declared on this annotation target and nested annotation targets.
The
| |
| annotations | back to summary |
|---|---|
| public default Collection Returns the annotation instances with given name declared on this annotation target and nested annotation targets.
The
| |
| annotations | back to summary |
|---|---|
| public default Collection Returns the annotation instances of given type declared on this annotation target and nested annotation targets.
The
| |
| annotations | back to summary |
|---|---|
| public Collection Returns the annotation instances declared on this annotation target and nested annotation targets.
The
| |
| annotationsWithRepeatable | back to summary |
|---|---|
| public Collection Returns the annotation instances with given name declared on this annotation target and nested annotation targets.
The
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
| |
| annotationsWithRepeatable | back to summary |
|---|---|
| public default Collection Returns the annotation instances with given name declared on this annotation target and nested annotation targets.
The
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
| |
| annotationsWithRepeatable | back to summary |
|---|---|
| public default Collection Returns the annotation instances of given type declared on this annotation target and nested annotation targets.
The
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
| |
| asClass | back to summary |
|---|---|
| public ClassInfo asClass() Casts and returns this target as a
| |
| asDeclaration | back to summary |
|---|---|
| public Declaration asDeclaration() Casts and returns this annotation target as a
| |
| asField | back to summary |
|---|---|
| public FieldInfo asField() Casts and returns this target as a
| |
| asMethod | back to summary |
|---|---|
| public MethodInfo asMethod() Casts and returns this target as a
| |
| asMethodParameter | back to summary |
|---|---|
| public MethodParameterInfo asMethodParameter() Casts and returns this target as a
| |
| asRecordComponent | back to summary |
|---|---|
| public RecordComponentInfo asRecordComponent() Casts and returns this target as a
| |
| asType | back to summary |
|---|---|
| public TypeTarget asType() Casts and returns this target as a
| |
| declaredAnnotation | back to summary |
|---|---|
| public AnnotationInstance declaredAnnotation(DotName name) Returns the annotation instance with given name declared on this annotation target.
Unlike
| |
| declaredAnnotation | back to summary |
|---|---|
| public default AnnotationInstance declaredAnnotation(String name) Returns the annotation instance with given name declared on this annotation target.
Unlike
| |
| declaredAnnotation | back to summary |
|---|---|
| public default AnnotationInstance declaredAnnotation(Class<? extends Annotation> clazz) Returns the annotation instance of given type declared on this annotation target.
Unlike
| |
| declaredAnnotations | back to summary |
|---|---|
| public Collection Returns the annotation instances declared on this annotation target.
Unlike
| |
| declaredAnnotationsWithRepeatable | back to summary |
|---|---|
| public Collection Returns the annotation instances with given name declared on this annotation target.
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
Unlike
| |
| declaredAnnotationsWithRepeatable | back to summary |
|---|---|
| public default Collection Returns the annotation instances with given name declared on this annotation target.
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
Unlike
| |
| declaredAnnotationsWithRepeatable | back to summary |
|---|---|
| public default Collection Returns the annotation instances of given type declared on this annotation target.
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
Unlike
| |
| hasAnnotation | back to summary |
|---|---|
| public boolean hasAnnotation(DotName name) Returns whether an annotation instance with given name is declared on this annotation target or any of its nested annotation targets.
| |
| hasAnnotation | back to summary |
|---|---|
| public default boolean hasAnnotation(String name) Returns whether an annotation instance with given name is declared on this annotation target or any of its nested annotation targets.
| |
| hasAnnotation | back to summary |
|---|---|
| public default boolean hasAnnotation(Class<? extends Annotation> clazz) Returns whether an annotation instance of given type is declared on this annotation target or any of its nested annotation targets.
| |
| hasDeclaredAnnotation | back to summary |
|---|---|
| public boolean hasDeclaredAnnotation(DotName name) Returns whether an annotation instance with given name is declared on this annotation target.
Unlike
| |
| hasDeclaredAnnotation | back to summary |
|---|---|
| public default boolean hasDeclaredAnnotation(String name) Returns whether an annotation instance with given name is declared on this annotation target.
Unlike
| |
| hasDeclaredAnnotation | back to summary |
|---|---|
| public default boolean hasDeclaredAnnotation(Class<? extends Annotation> clazz) Returns whether an annotation instance of given type is declared on this annotation target.
Unlike
| |
| isDeclaration | back to summary |
|---|---|
| public boolean isDeclaration() Returns whether this annotation target is a declaration.
| |
| kind | back to summary |
|---|---|
| public AnnotationTarget. Returns the kind of object this target represents.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final AnnotationTarget. | CLASS
An object of type |
| public static final AnnotationTarget. | FIELD
An object of type |
| public static final AnnotationTarget. | METHOD
An object of type |
| public static final AnnotationTarget. | METHOD_PARAMETER
An object of type |
| public static final AnnotationTarget. | RECORD_COMPONENT
An object of type |
| public static final AnnotationTarget. | TYPE
An object of type |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static AnnotationTarget. | |
| public static AnnotationTarget. |
| CLASS | back to summary |
|---|---|
| public static final AnnotationTarget. An object of type | |
| FIELD | back to summary |
|---|---|
| public static final AnnotationTarget. An object of type | |
| METHOD | back to summary |
|---|---|
| public static final AnnotationTarget. An object of type | |
| METHOD_PARAMETER | back to summary |
|---|---|
| public static final AnnotationTarget. An object of type | |
| RECORD_COMPONENT | back to summary |
|---|---|
| public static final AnnotationTarget. An object of type
| |
| TYPE | back to summary |
|---|---|
| public static final AnnotationTarget. An object of type | |
| Kind | back to summary |
|---|---|
| private Kind() | |
| valueOf | back to summary |
|---|---|
| public static AnnotationTarget. | |
| values | back to summary |
|---|---|
| public static AnnotationTarget. | |