public interface AnnotationInfo
AnnotationTarget.
Provides access to annotation members and their values.
Implementations of this interface are required to define the equals and hashCode methods.
Implementations of this interface are encouraged to define the toString method such that
it returns a text resembling the corresponding Java™ syntax.
There is no guarantee that any particular annotation instance, represented by an implementation of this interface,
will always be represented by the same object. That includes natural singletons such as the jakarta.inject.Singleton
annotation. Instances should always be compared using equals.
| Modifier and Type | Method and Description |
|---|---|
ClassInfo |
declaration()
Returns the declaration of this annotation's type.
|
boolean |
hasMember(java.lang.String name)
Returns whether this annotation has a member with given
name. |
default boolean |
hasValue()
Returns whether this annotation has the
value member. |
default boolean |
isRepeatable()
Returns whether this annotation is repeatable.
|
AnnotationMember |
member(java.lang.String name)
Returns the value of this annotation's member with given
name. |
java.util.Map<java.lang.String,AnnotationMember> |
members()
Returns all members of this annotation as a map, where the key is the member name
and the value is the member value.
|
default java.lang.String |
name()
Binary name of this annotation's type, as defined by The Java™ Language Specification;
in other words, the annotation type name as returned by
Class.getName(). |
default AnnotationMember |
value()
|
ClassInfo declaration()
nulldefault java.lang.String name()
Class.getName().
Equivalent to declaration().name().nulldefault boolean isRepeatable()
@Repeatable.boolean hasMember(java.lang.String name)
name.name - member name, must not be nulltrue if this annotation has a member with given name, false otherwiseAnnotationMember member(java.lang.String name)
name.name - member name, must not be nullname or null if such member does not existdefault boolean hasValue()
value member.true if this annotation has the value member, false otherwisedefault AnnotationMember value()
value member or null if the member does not existjava.util.Map<java.lang.String,AnnotationMember> members()
null