Package jakarta.enterprise.lang.model
Interface AnnotationMember
- 
 public interface AnnotationMemberThe value of an annotation member. Annotation member values are of several kinds:- primitive constants;
- Stringconstants;
- Enumconstants;
- Classliterals;
- nested Annotations;
- arrays of previously mentioned types.
 kind()method returns the kind of this annotation member value. Theis*methods (such asisBoolean()) allow checking if this annotation member value is of given kind. Theas*methods (such asasBoolean()) 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 anint, callingasLong()will throw an exception.Implementations of this interface are required to define the equalsandhashCodemethods. Implementations of this interface are encouraged to define thetoStringmethod 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 booleanvalues. Instances should always be compared usingequals.- Since:
- 4.0
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classAnnotationMember.KindThe kind of the annotation member value.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<AnnotationMember>asArray()Returns this array value as an immutableListofAnnotationMembers.booleanasBoolean()Returns this value as aboolean.byteasByte()Returns this value as abyte.charasChar()Returns this value as achar.doubleasDouble()Returns this value as adouble.<E extends Enum<E>>
 EasEnum(Class<E> enumType)Returns this enum value as an instance of the enum type.ClassInfoasEnumClass()Returns the type of this enum value.StringasEnumConstant()Returns the name of this enum value.floatasFloat()Returns this value as afloat.intasInt()Returns this value as anint.longasLong()Returns this value as along.AnnotationInfoasNestedAnnotation()Returns this nested annotation value as anAnnotationInfo.shortasShort()Returns this value as ashort.StringasString()Returns this value as aString.TypeasType()Returns this class value as aType.default booleanisArray()default booleanisBoolean()default booleanisByte()default booleanisChar()default booleanisClass()default booleanisDouble()default booleanisEnum()default booleanisFloat()default booleanisInt()default booleanisLong()default booleanisNestedAnnotation()default booleanisShort()default booleanisString()AnnotationMember.Kindkind()Returns the kind of this annotation member value.
 
- 
- 
- 
Field Detail- 
VALUEstatic final String VALUE Name of the commonly usedvalue()annotation member.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
kindAnnotationMember.Kind kind() Returns the kind of this annotation member value.- Returns:
- the kind of this annotation member value, never null
 
 - 
isBooleandefault boolean isBoolean() - Returns:
- trueif the kind is a- boolean,- falseotherwise
 
 - 
isBytedefault boolean isByte() - Returns:
- trueif the kind is a- byte,- falseotherwise
 
 - 
isShortdefault boolean isShort() - Returns:
- trueif the kind is a- short,- falseotherwise
 
 - 
isIntdefault boolean isInt() - Returns:
- trueif the kind is an- int,- falseotherwise
 
 - 
isLongdefault boolean isLong() - Returns:
- trueif the kind is a- long,- falseotherwise
 
 - 
isFloatdefault boolean isFloat() - Returns:
- trueif the kind is a- float,- falseotherwise
 
 - 
isDoubledefault boolean isDouble() - Returns:
- trueif the kind is a- double,- falseotherwise
 
 - 
isChardefault boolean isChar() - Returns:
- trueif the kind is a- char,- falseotherwise
 
 - 
isStringdefault boolean isString() - Returns:
- trueif the kind is a- String,- falseotherwise
 
 - 
isEnumdefault boolean isEnum() - Returns:
- trueif the kind is an- Enum,- falseotherwise
 
 - 
isClassdefault boolean isClass() - Returns:
- trueif the kind is a- Class,- falseotherwise
 
 - 
isNestedAnnotationdefault boolean isNestedAnnotation() - Returns:
- trueif the kind is a nested- Annotation,- falseotherwise
 
 - 
isArraydefault boolean isArray() - Returns:
- trueif the kind is an array,- falseotherwise
 
 - 
asBooleanboolean asBoolean() Returns this value as aboolean.- Returns:
- the boolean value
- Throws:
- IllegalStateException- if this annotation member value is not a- boolean
 
 - 
asBytebyte asByte() Returns this value as abyte.- Returns:
- the byte value
- Throws:
- IllegalStateException- if this annotation member value is not a- byte
 
 - 
asShortshort asShort() Returns this value as ashort.- Returns:
- the short value
- Throws:
- IllegalStateException- if this annotation member value is not a- short
 
 - 
asIntint asInt() Returns this value as anint.- Returns:
- the int value
- Throws:
- IllegalStateException- if this annotation member value is not an- int
 
 - 
asLonglong asLong() Returns this value as along.- Returns:
- the long value
- Throws:
- IllegalStateException- if this annotation member value is not a- long
 
 - 
asFloatfloat asFloat() Returns this value as afloat.- Returns:
- the float value
- Throws:
- IllegalStateException- if this annotation member value is not a- float
 
 - 
asDoubledouble asDouble() Returns this value as adouble.- Returns:
- the double value
- Throws:
- IllegalStateException- if this annotation member value is not a- double
 
 - 
asCharchar asChar() Returns this value as achar.- Returns:
- the char value
- Throws:
- IllegalStateException- if this annotation member value is not a- char
 
 - 
asStringString asString() Returns this value as aString.- Returns:
- the String value
- Throws:
- IllegalStateException- if this annotation member value is not a- String
 
 - 
asEnum<E extends Enum<E>> E asEnum(Class<E> enumType) Returns this enum value as an instance of the enum type.- Type Parameters:
- E- the enum generic type
- Parameters:
- enumType- the enum type
- Returns:
- the enum instance
- Throws:
- IllegalArgumentException- if given- enumTypeis not an enum type
- IllegalStateException- if this annotation member value is not an enum value
 
 - 
asEnumClassClassInfo asEnumClass() Returns the type of this enum value.- Returns:
- a ClassInforepresenting the enum type
- Throws:
- IllegalStateException- if this annotation member value is not an enum value
 
 - 
asEnumConstantString asEnumConstant() Returns the name of this enum value.- Returns:
- the name of this enum value
- Throws:
- IllegalStateException- if this annotation member value is not an enum value
 
 - 
asTypeType asType() Returns this class value as aType. It can be:- Returns:
- the class value, as a Type
- Throws:
- IllegalStateException- if this annotation member value is not a class value
 
 - 
asNestedAnnotationAnnotationInfo asNestedAnnotation() Returns this nested annotation value as anAnnotationInfo.- Returns:
- an AnnotationInfoinstance
- Throws:
- IllegalStateException- if this annotation member value is not a nested annotation
 
 - 
asArrayList<AnnotationMember> asArray() Returns this array value as an immutableListofAnnotationMembers. Returns an empty list if the array is empty.- Returns:
- an immutable list of AnnotationMembers
- Throws:
- IllegalStateException- if this annotation member value is not an array
 
 
- 
 
-