Top Description Methods
jakarta.enterprise.lang.model

public Interface AnnotationInfo

Imports
java.lang.annotation.Repeatable, java.util.Map, jakarta.enterprise.lang.model.declarations.ClassInfo

An annotation instance, typically obtained from an 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.

Since
4.0

Method Summary

Modifier and TypeMethod and Description
public ClassInfo

Returns:

the declaration of this annotation's type, never null
declaration
()

Returns the declaration of this annotation's type.

public boolean

Returns:

true if this annotation has a member with given name, false otherwise
hasMember
(String
member name, must not be null
name
)

Returns whether this annotation has a member with given name.

public default boolean

Returns:

true if this annotation has the value member, false otherwise
hasValue
()

Returns whether this annotation has the value member.

public default boolean

Returns:

whether this annotation is repeatable
isRepeatable
()

Returns whether this annotation is repeatable.

public AnnotationMember

Returns:

value of this annotation's member with given name or null if such member does not exist
member
(String
member name, must not be null
name
)

Returns the value of this annotation's member with given name.

public Map<String, AnnotationMember>

Returns:

an immutable map of all members of this annotation, never null
members
()

Returns all members of this annotation as a map, where the key is the member name and the value is the member value.

public default String

Returns:

binary name of this annotation's type, never null
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().

public default AnnotationMember

Returns:

value of this annotation's value member or null if the member does not exist
value
()

Returns the value of this annotation's value member.

Method Detail

declarationback to summary
public ClassInfo declaration()

Returns the declaration of this annotation's type.

Returns:ClassInfo

the declaration of this annotation's type, never null

hasMemberback to summary
public boolean hasMember(String name)

Returns whether this annotation has a member with given name.

Parameters
name:String

member name, must not be null

Returns:boolean

true if this annotation has a member with given name, false otherwise

hasValueback to summary
public default boolean hasValue()

Returns whether this annotation has the value member.

Returns:boolean

true if this annotation has the value member, false otherwise

isRepeatableback to summary
public default boolean isRepeatable()

Returns whether this annotation is repeatable. In other words, returns whether this annotation's type is meta-annotated @Repeatable.

Returns:boolean

whether this annotation is repeatable

memberback to summary
public AnnotationMember member(String name)

Returns the value of this annotation's member with given name.

Parameters
name:String

member name, must not be null

Returns:AnnotationMember

value of this annotation's member with given name or null if such member does not exist

membersback to summary
public Map<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. Returns an empty map if this annotation has no members.

Returns:Map<String, AnnotationMember>

an immutable map of all members of this annotation, never null

nameback to summary
public default 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(). Equivalent to declaration().name().

Returns:String

binary name of this annotation's type, never null

valueback to summary
public default AnnotationMember value()

Returns the value of this annotation's value member.

Returns:AnnotationMember

value of this annotation's value member or null if the member does not exist