Top Description Inners Fields Constructors Methods
org.jboss.jandex

public abstract Class AnnotationValue

extends Object
Class Inheritance
Known Direct Subclasses
org.jboss.jandex.AnnotationValue.StringValue, org.jboss.jandex.AnnotationValue.ByteValue, org.jboss.jandex.AnnotationValue.CharacterValue, org.jboss.jandex.AnnotationValue.DoubleValue, org.jboss.jandex.AnnotationValue.FloatValue, org.jboss.jandex.AnnotationValue.ShortValue, org.jboss.jandex.AnnotationValue.IntegerValue, org.jboss.jandex.AnnotationValue.LongValue, org.jboss.jandex.AnnotationValue.BooleanValue, org.jboss.jandex.AnnotationValue.EnumValue, org.jboss.jandex.AnnotationValue.ClassValue, org.jboss.jandex.AnnotationValue.NestedAnnotation, org.jboss.jandex.AnnotationValue.ArrayValue
Imports
java.util.ArrayList, .Arrays, .List

An annotation value represents a specific name and value combination in the parameter list of an annotation instance. It also can represent a nested array element in the case of an array value.

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.
Author
Jason T. Greene

Nested and Inner Type Summary

Modifier and TypeClass 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

Field Summary

Modifier and TypeField and Description
pack-priv static final AnnotationValue[]
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv AnnotationValue[]
public List<AnnotationValue>

Returns:

the underlying array value
asArrayList
()

Returns the underlying array value as a List of AnnotationValue.

public boolean

Returns:

a boolean representing the character parameter
asBoolean
()

Returns the underlying boolean value as Java primitive boolean.

public boolean[]

Returns:

a boolean array that represents this value
asBooleanArray
()

Returns the underlying boolean array.

public byte

Returns:

a byte representing the numerical parameter
asByte
()

Converts the underlying numerical type to a byte as if it was casted in Java.

public byte[]

Returns:

a byte array that represents this value
asByteArray
()

Converts an underlying numerical array to a Java primitive byte array.

public char

Returns:

a char representing the character parameter
asChar
()

Returns the underlying character value as Java primitive char.

public char[]

Returns:

a character array that represents this value
asCharArray
()

Returns the underlying character array.

public Type

Returns:

the Java type of this value
asClass
()

Returns the class name, in Type form, that represents a Java Class used by this value.

public Type[]

Returns:

a class array representing this class array value
asClassArray
()

Returns an array of class types representing the underlying class array value.

public double

Returns:

a double representing the numerical parameter
asDouble
()

Converts the underlying numerical type to a double as if it was casted in Java.

public double[]

Returns:

a double array that represents this value
asDoubleArray
()

Converts an underlying numerical array to a Java primitive double array.

public String

Returns:

the string name of a Java enumeration
asEnum
()

Returns 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 enums
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 by Enum#name().

public DotName

Returns:

the type name of a Java enumeration
asEnumType
()

Returns 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 elements
asEnumTypeArray
()

Returns 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 parameter
asFloat
()

Converts the underlying numerical type to a float as if it was casted in Java.

public float[]

Returns:

a float array that represents this value
asFloatArray
()

Converts an underlying numerical array to a Java primitive float array.

public int

Returns:

an integer representing the numerical parameter
asInt
()

Converts the underlying numerical type to an integer as if it was casted in Java.

public int[]

Returns:

an int array that represents this value
asIntArray
()

Converts an underlying numerical array to a Java primitive integer array.

public long

Returns:

a long representing the numerical parameter
asLong
()

Converts the underlying numerical type to an long as if it was casted in Java.

public long[]

Returns:

a long array that represents this value
asLongArray
()

Converts an underlying numerical array to a Java primitive long array.

public AnnotationInstance

Returns:

the underlying nested annotation instance
asNested
()

Returns a nested annotation represented by this value.

public AnnotationInstance[]

Returns:

an annotation array representing this annotation array value
asNestedArray
()

Returns an array of nested annotations representing the underlying annotation array value.

public short

Returns:

a short representing the numerical parameter
asShort
()

Converts the underlying numerical type to a short as if it was casted in Java.

public short[]

Returns:

a short array that represents this value
asShortArray
()

Converts an underlying numerical array to a Java primitive short array.

public String

Returns:

a string representing the value parameter
asString
()

Returns the string representation of the underlying value type.

public String[]

Returns:

a string array representing the underlying array value
asStringArray
()

Returns a string array representation of the underlying array value.

public AnnotationValue.Kind

Returns:

the kind of component, or Kind#UNKNOWN if it can not be determined.
componentKind
()

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
createBooleanValue(String name, boolean bool)

public static AnnotationValue
createByteValue(String name, byte b)

public static AnnotationValue
public static AnnotationValue
public static AnnotationValue
createDoubleValue(String name, double d)

public static AnnotationValue
createDouleValue(String name, double d)

Deprecated Use createDoubleValue(String, double) instead.
public static AnnotationValue
createEnumValue(String name, DotName typeName, String value)

public static AnnotationValue
createFloatValue(String name, float f)

public static AnnotationValue
public static AnnotationValue
createLongalue(String name, long l)

Deprecated Use createLongValue(String, long) instead.
public static AnnotationValue
createLongValue(String name, long l)

public static AnnotationValue
public static AnnotationValue
createShortValue(String name, short s)

public static AnnotationValue
public boolean

Returns:

true if equal, false if not
equals
(Object
the annotation value to compare to.
o
)

Overrides java.lang.Object.equals.

Compares this annotation value to another annotation value, and returns true if equal.
public int

Returns:

the hash code for this annotation value
hashCode
()

Overrides java.lang.Object.hashCode.

Computes a hash code for this annotation value.
public abstract AnnotationValue.Kind

Returns:

the kind of value
kind
()

Returns the kind of this value.

public final String

Returns:

the name of this value
name
()

Returns the name of this value, which is typically the parameter name in the annotation declaration.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv String
toString(boolean includeName)

public abstract Object

Returns:

the underlying value
value
()

Returns a detyped value that represents the underlying annotation value.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait