Package org.jboss.jandex
Class AnnotationValue.ArrayValue
- java.lang.Object
-
- org.jboss.jandex.AnnotationValue
-
- org.jboss.jandex.AnnotationValue.ArrayValue
-
- Enclosing class:
- AnnotationValue
static final class AnnotationValue.ArrayValue extends AnnotationValue
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.jandex.AnnotationValue
AnnotationValue.ArrayValue, AnnotationValue.BooleanValue, AnnotationValue.ByteValue, AnnotationValue.CharacterValue, AnnotationValue.ClassValue, AnnotationValue.DoubleValue, AnnotationValue.EnumValue, AnnotationValue.FloatValue, AnnotationValue.IntegerValue, AnnotationValue.Kind, AnnotationValue.LongValue, AnnotationValue.NestedAnnotation, AnnotationValue.ShortValue, AnnotationValue.StringValue
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationValue[]
value
-
Fields inherited from class org.jboss.jandex.AnnotationValue
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description ArrayValue(java.lang.String name, AnnotationValue[] value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) AnnotationValue[]
asArray()
java.util.List<AnnotationValue>
asArrayList()
Returns the underlying array value as aList
ofAnnotationValue
.boolean[]
asBooleanArray()
Returns the underlying boolean array.byte[]
asByteArray()
Converts an underlying numerical array to a Java primitive byte array.char[]
asCharArray()
Returns the underlying character array.Type[]
asClassArray()
Returns an array of class types representing the underlying class array value.double[]
asDoubleArray()
Converts an underlying numerical array to a Java primitive double array.java.lang.String[]
asEnumArray()
Returns 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 byEnum.name()
.DotName[]
asEnumTypeArray()
Returns an array of the type name, in DotName form, that represents the Java enumeration of each array element.float[]
asFloatArray()
Converts an underlying numerical array to a Java primitive float array.int[]
asIntArray()
Converts an underlying numerical array to a Java primitive integer array.long[]
asLongArray()
Converts an underlying numerical array to a Java primitive long array.AnnotationInstance[]
asNestedArray()
Returns an array of nested annotations representing the underlying annotation array value.short[]
asShortArray()
Converts an underlying numerical array to a Java primitive short array.java.lang.String[]
asStringArray()
Returns a string array representation of the underlying array value.AnnotationValue.Kind
componentKind()
Returns the kind of value that represents the component type of this array if it can be determined.boolean
equals(java.lang.Object o)
Compares this annotation value to another annotation value, and returns true if equal.int
hashCode()
Computes a hash code for this annotation value.AnnotationValue.Kind
kind()
Returns the kind of this value.(package private) java.lang.String
toString(boolean includeName)
AnnotationValue[]
value()
Returns a detyped value that represents the underlying annotation value.-
Methods inherited from class org.jboss.jandex.AnnotationValue
asBoolean, asByte, asChar, asClass, asDouble, asEnum, asEnumType, asFloat, asInt, asLong, asNested, asShort, asString, createArrayValue, createArrayValue, createBooleanValue, createByteValue, createCharacterValue, createClassValue, createDoubleValue, createDouleValue, createEnumValue, createFloatValue, createIntegerValue, createLongalue, createLongValue, createNestedAnnotationValue, createShortValue, createStringValue, name, toString
-
-
-
-
Field Detail
-
value
private final AnnotationValue[] value
-
-
Constructor Detail
-
ArrayValue
ArrayValue(java.lang.String name, AnnotationValue[] value)
-
-
Method Detail
-
value
public AnnotationValue[] value()
Description copied from class:AnnotationValue
Returns a detyped value that represents the underlying annotation value. It is recommended that the type specific methods be used instead.- Specified by:
value
in classAnnotationValue
- Returns:
- the underlying value
-
kind
public AnnotationValue.Kind kind()
Description copied from class:AnnotationValue
Returns the kind of this value. The kind includes all Java primitives, String and Enum types, nested values, and finally arrays of the above. Since the return type is itself an enumeration, it can be used with Java switch statements.A special
AnnotationValue.Kind.UNKNOWN
kind is used to refer to components of zero-length arrays, as the underlying type is not known.- Specified by:
kind
in classAnnotationValue
- Returns:
- the kind of value
-
componentKind
public AnnotationValue.Kind componentKind()
Description copied from class:AnnotationValue
Returns the kind of value that represents the component type of this array if it can be determined. Otherwise, this method returnsAnnotationValue.Kind.UNKNOWN
. This happens when the annotation value represents an empty array. If the underlying value is not an array an exception will be thrown.- Overrides:
componentKind
in classAnnotationValue
- Returns:
- the kind of component, or
AnnotationValue.Kind.UNKNOWN
if it can not be determined.
-
asArray
AnnotationValue[] asArray()
- Overrides:
asArray
in classAnnotationValue
-
asArrayList
public java.util.List<AnnotationValue> asArrayList()
Description copied from class:AnnotationValue
Returns the underlying array value as aList
ofAnnotationValue
.- Overrides:
asArrayList
in classAnnotationValue
- Returns:
- the underlying array value
-
toString
java.lang.String toString(boolean includeName)
- Overrides:
toString
in classAnnotationValue
-
asIntArray
public int[] asIntArray()
Description copied from class:AnnotationValue
Converts an underlying numerical array to a Java primitive integer array.- Overrides:
asIntArray
in classAnnotationValue
- Returns:
- an int array that represents this value
-
asLongArray
public long[] asLongArray()
Description copied from class:AnnotationValue
Converts an underlying numerical array to a Java primitive long array.- Overrides:
asLongArray
in classAnnotationValue
- Returns:
- a long array that represents this value
-
asShortArray
public short[] asShortArray()
Description copied from class:AnnotationValue
Converts an underlying numerical array to a Java primitive short array.- Overrides:
asShortArray
in classAnnotationValue
- Returns:
- a short array that represents this value
-
asByteArray
public byte[] asByteArray()
Description copied from class:AnnotationValue
Converts an underlying numerical array to a Java primitive byte array.- Overrides:
asByteArray
in classAnnotationValue
- Returns:
- a byte array that represents this value
-
asFloatArray
public float[] asFloatArray()
Description copied from class:AnnotationValue
Converts an underlying numerical array to a Java primitive float array.- Overrides:
asFloatArray
in classAnnotationValue
- Returns:
- a float array that represents this value
-
asDoubleArray
public double[] asDoubleArray()
Description copied from class:AnnotationValue
Converts an underlying numerical array to a Java primitive double array.- Overrides:
asDoubleArray
in classAnnotationValue
- Returns:
- a double array that represents this value
-
asCharArray
public char[] asCharArray()
Description copied from class:AnnotationValue
Returns the underlying character array.- Overrides:
asCharArray
in classAnnotationValue
- Returns:
- a character array that represents this value
-
asBooleanArray
public boolean[] asBooleanArray()
Description copied from class:AnnotationValue
Returns the underlying boolean array.- Overrides:
asBooleanArray
in classAnnotationValue
- Returns:
- a boolean array that represents this value
-
asStringArray
public java.lang.String[] asStringArray()
Description copied from class:AnnotationValue
Returns a string array representation of the underlying array value. The behavior is identical toAnnotationValue.asString()
as if it were applied to every array element.- Overrides:
asStringArray
in classAnnotationValue
- Returns:
- a string array representing the underlying array value
-
asEnumArray
public java.lang.String[] asEnumArray()
Description copied from class:AnnotationValue
Returns 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 byEnum.name()
.- Overrides:
asEnumArray
in classAnnotationValue
- Returns:
- an array of string names of a Java enums
-
asClassArray
public Type[] asClassArray()
Description copied from class:AnnotationValue
Returns an array of class types representing the underlying class array value. Each element has the same behavior asAnnotationValue.asClass()
- Overrides:
asClassArray
in classAnnotationValue
- Returns:
- a class array representing this class array value
-
asNestedArray
public AnnotationInstance[] asNestedArray()
Description copied from class:AnnotationValue
Returns an array of nested annotations representing the underlying annotation array value. Each element has the same behavior asAnnotationValue.asNested()
- Overrides:
asNestedArray
in classAnnotationValue
- Returns:
- an annotation array representing this annotation array value
-
asEnumTypeArray
public DotName[] asEnumTypeArray()
Description copied from class:AnnotationValue
Returns an array of the type name, in DotName form, that represents the Java enumeration of each array element. The individual element values are the same as the one returned byObject.getClass()
. Note that JLS restricts an enum array parameter to the same type. Also, when an empty array is specified in a value, it's types can not be determined.- Overrides:
asEnumTypeArray
in classAnnotationValue
- Returns:
- an array of string type names of Java enum array elements
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:AnnotationValue
Compares this annotation value to another annotation value, and returns true if equal.- Overrides:
equals
in classAnnotationValue
- Parameters:
o
- the annotation value to compare to.- Returns:
- true if equal, false if not
- See Also:
Object.equals(Object)
-
hashCode
public int hashCode()
Description copied from class:AnnotationValue
Computes a hash code for this annotation value.- Overrides:
hashCode
in classAnnotationValue
- Returns:
- the hash code for this annotation value
- See Also:
Object.hashCode()
-
-