Interface AnnotationMember


public interface AnnotationMember
The value of an annotation member. Annotation member values are of several kinds:
  • primitive constants;
  • String constants;
  • Enum constants;
  • Class literals;
  • nested Annotations;
  • arrays of previously mentioned types.
The kind() method returns the kind of this annotation member value. The is* methods (such as isBoolean()) allow checking if this annotation member value is of given kind. The as* methods (such as asBoolean()) allow "unwrapping" this annotation member value, if it is of the corresponding kind.

Note that the as* methods do not perform type conversion, so if this annotation member value is an int, calling asLong() will throw an exception.

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 member, represented by an implementation of this interface, will always be represented by the same object. This includes natural singletons such as boolean values. Instances should always be compared using equals.

Since:
4.0