An annotation value can be any Java primitive:
As well as any the following specialty types:
In addition a value can be a single-dimension array of any of the above types
To access a value, the proper typed method must be used that matches the
expected type of the annotation parameter. In addition, some methods will
allow conversion of different types. For example, a byte can be returned as
an integer using asInt(). Also all value types support a
String representation.
To determine the underlying type, kind() can be used.
Thread-Safety
This class is immutable and can be shared between threads without safe publication.| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| public static enum | AnnotationValue.Kind
Specifies the kind of annotation value, which can be used to determine the underlying Java type. |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final AnnotationValue[] | |
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv AnnotationValue[] | |
| public List | Returns: the underlying array valueReturns the underlying array value as a |
| public boolean | Returns: a boolean representing the character parameterReturns the underlying boolean value as Java primitive boolean. |
| public boolean[] | Returns: a boolean array that represents this valueReturns the underlying boolean array. |
| public byte | Returns: a byte representing the numerical parameterConverts the underlying numerical type to a byte as if it was casted in Java. |
| public byte[] | Returns: a byte array that represents this valueConverts an underlying numerical array to a Java primitive byte array. |
| public char | Returns: a char representing the character parameterReturns the underlying character value as Java primitive char. |
| public char[] | Returns: a character array that represents this valueReturns the underlying character array. |
| public Type | |
| public Type[] | Returns: a class array representing this class array valueReturns an array of class types representing the underlying class array value. |
| public double | Returns: a double representing the numerical parameterConverts the underlying numerical type to a double as if it was casted in Java. |
| public double[] | Returns: a double array that represents this valueConverts an underlying numerical array to a Java primitive double array. |
| public String | Returns: the string name of a Java enumerationReturns the constant name, in string form, that represents the Java enumeration of this value. |
| public String[] | Returns: an array of string names of a Java enumsReturns an array of the constant name, in string form, that represents the
Java enumeration of each array element The individual element values are
the same as the one returned by |
| public DotName | Returns: the type name of a Java enumerationReturns the type name, in DotName form, that represents the Java enumeration of this value. |
| public DotName[] | Returns: an array of string type names of Java enum array elementsReturns an array of the type name, in DotName form, that represents the Java enumeration of each array element. |
| public float | Returns: a float representing the numerical parameterConverts the underlying numerical type to a float as if it was casted in Java. |
| public float[] | Returns: a float array that represents this valueConverts an underlying numerical array to a Java primitive float array. |
| public int | Returns: an integer representing the numerical parameterConverts the underlying numerical type to an integer as if it was casted in Java. |
| public int[] | Returns: an int array that represents this valueConverts an underlying numerical array to a Java primitive integer array. |
| public long | Returns: a long representing the numerical parameterConverts the underlying numerical type to an long as if it was casted in Java. |
| public long[] | Returns: a long array that represents this valueConverts an underlying numerical array to a Java primitive long array. |
| public AnnotationInstance | Returns: the underlying nested annotation instanceReturns a nested annotation represented by this value. |
| public AnnotationInstance[] | Returns: an annotation array representing this annotation array valueReturns an array of nested annotations representing the underlying annotation array value. |
| public short | Returns: a short representing the numerical parameterConverts the underlying numerical type to a short as if it was casted in Java. |
| public short[] | Returns: a short array that represents this valueConverts an underlying numerical array to a Java primitive short array. |
| public String | Returns: a string representing the value parameterReturns the string representation of the underlying value type. |
| public String[] | Returns: a string array representing the underlying array valueReturns a string array representation of the underlying array value. |
| public AnnotationValue. | Returns: the kind of component, orKind#UNKNOWN if it can not be determined.Returns the kind of value that represents the component type of this array if it can be determined. |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public static AnnotationValue | |
| public boolean | Returns: true if equal, false if notthe annotation value to compare to. o)Overrides java. |
| public int | Returns: the hash code for this annotation valueOverrides java. |
| public abstract AnnotationValue. | |
| public final String | Returns: the name of this valueReturns the name of this value, which is typically the parameter name in the annotation declaration. |
| public String | |
| pack-priv String | |
| public abstract Object | Returns: the underlying valueReturns a detyped value that represents the underlying annotation value. |