U
- The type where primitive values are represented by their boxed type.public static class AnnotationValue.ForConstant<U> extends AnnotationValue.AbstractBase<U,U>
String
or an array of the latter types.Modifier and Type | Class and Description |
---|---|
protected static class |
AnnotationValue.ForConstant.Loaded<V>
Represents a trivial loaded value.
|
protected static interface |
AnnotationValue.ForConstant.PropertyDelegate
A property delegate for a constant annotation value.
|
AnnotationValue.AbstractBase<U,V>, AnnotationValue.ForAnnotationDescription<U extends java.lang.annotation.Annotation>, AnnotationValue.ForConstant<U>, AnnotationValue.ForDescriptionArray<U,V>, AnnotationValue.ForEnumerationDescription<U extends java.lang.Enum<U>>, AnnotationValue.ForTypeDescription<U extends java.lang.Class<U>>, AnnotationValue.RenderingDispatcher
Modifier and Type | Field and Description |
---|---|
private AnnotationValue.ForConstant.PropertyDelegate |
propertyDelegate
The property delegate for the value's type.
|
private U |
value
The represented value.
|
UNDEFINED
Modifier | Constructor and Description |
---|---|
protected |
ForConstant(U value,
AnnotationValue.ForConstant.PropertyDelegate propertyDelegate)
Creates a new constant annotation value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
AnnotationValue.Loaded<U> |
load(java.lang.ClassLoader classLoader)
Returns the loaded value of this annotation.
|
static AnnotationValue<boolean[],boolean[]> |
of(boolean... value)
Creates an annotation value for a
boolean[] value. |
static AnnotationValue<java.lang.Boolean,java.lang.Boolean> |
of(boolean value)
Creates an annotation value for a
boolean value. |
static AnnotationValue<byte[],byte[]> |
of(byte... value)
Creates an annotation value for a
byte[] value. |
static AnnotationValue<java.lang.Byte,java.lang.Byte> |
of(byte value)
Creates an annotation value for a
byte value. |
static AnnotationValue<char[],char[]> |
of(char... value)
Creates an annotation value for a
char[] value. |
static AnnotationValue<java.lang.Character,java.lang.Character> |
of(char value)
Creates an annotation value for a
char value. |
static AnnotationValue<double[],double[]> |
of(double... value)
Creates an annotation value for a
double[] value. |
static AnnotationValue<java.lang.Double,java.lang.Double> |
of(double value)
Creates an annotation value for a
double value. |
static AnnotationValue<float[],float[]> |
of(float... value)
Creates an annotation value for a
float[] value. |
static AnnotationValue<java.lang.Float,java.lang.Float> |
of(float value)
Creates an annotation value for a
float value. |
static AnnotationValue<int[],int[]> |
of(int... value)
Creates an annotation value for a
int[] value. |
static AnnotationValue<java.lang.Integer,java.lang.Integer> |
of(int value)
Creates an annotation value for a
int value. |
static AnnotationValue<long[],long[]> |
of(long... value)
Creates an annotation value for a
long[] value. |
static AnnotationValue<java.lang.Long,java.lang.Long> |
of(long value)
Creates an annotation value for a
long value. |
static AnnotationValue<?,?> |
of(java.lang.Object value)
Creates an annotation value for any constant value, i.e any primitive (wrapper) type,
any primitive array type or any
String value or array. |
static AnnotationValue<short[],short[]> |
of(short... value)
Creates an annotation value for a
short[] value. |
static AnnotationValue<java.lang.Short,java.lang.Short> |
of(short value)
Creates an annotation value for a
short value. |
static AnnotationValue<java.lang.String[],java.lang.String[]> |
of(java.lang.String... value)
Creates an annotation value for a
String[] value. |
static AnnotationValue<java.lang.String,java.lang.String> |
of(java.lang.String value)
Creates an annotation value for a
String value. |
U |
resolve()
Resolves the unloaded value of this annotation.
|
java.lang.String |
toString() |
loadSilent, resolve
private final U value
private final AnnotationValue.ForConstant.PropertyDelegate propertyDelegate
protected ForConstant(U value, AnnotationValue.ForConstant.PropertyDelegate propertyDelegate)
value
- The represented value.propertyDelegate
- The property delegate for the value's type.public static AnnotationValue<java.lang.Boolean,java.lang.Boolean> of(boolean value)
boolean
value.value
- The boolean
value to represent.public static AnnotationValue<java.lang.Byte,java.lang.Byte> of(byte value)
byte
value.value
- The byte
value to represent.public static AnnotationValue<java.lang.Short,java.lang.Short> of(short value)
short
value.value
- The short
value to represent.public static AnnotationValue<java.lang.Character,java.lang.Character> of(char value)
char
value.value
- The char
value to represent.public static AnnotationValue<java.lang.Integer,java.lang.Integer> of(int value)
int
value.value
- The int
value to represent.public static AnnotationValue<java.lang.Long,java.lang.Long> of(long value)
long
value.value
- The long
value to represent.public static AnnotationValue<java.lang.Float,java.lang.Float> of(float value)
float
value.value
- The float
value to represent.public static AnnotationValue<java.lang.Double,java.lang.Double> of(double value)
double
value.value
- The double
value to represent.public static AnnotationValue<java.lang.String,java.lang.String> of(java.lang.String value)
String
value.value
- The String
value to represent.public static AnnotationValue<boolean[],boolean[]> of(boolean... value)
boolean[]
value.value
- The boolean[]
value to represent.public static AnnotationValue<byte[],byte[]> of(byte... value)
byte[]
value.value
- The byte[]
value to represent.public static AnnotationValue<short[],short[]> of(short... value)
short[]
value.value
- The short[]
value to represent.public static AnnotationValue<char[],char[]> of(char... value)
char[]
value.value
- The char[]
value to represent.public static AnnotationValue<int[],int[]> of(int... value)
int[]
value.value
- The int[]
value to represent.public static AnnotationValue<long[],long[]> of(long... value)
long[]
value.value
- The long[]
value to represent.public static AnnotationValue<float[],float[]> of(float... value)
float[]
value.value
- The float[]
value to represent.public static AnnotationValue<double[],double[]> of(double... value)
double[]
value.value
- The double[]
value to represent.public static AnnotationValue<java.lang.String[],java.lang.String[]> of(java.lang.String... value)
String[]
value.value
- The String[]
value to represent.public static AnnotationValue<?,?> of(java.lang.Object value)
String
value or array. If no constant annotation
type is provided, a runtime exception is thrown.value
- The value to represent.public U resolve()
public AnnotationValue.Loaded<U> load(java.lang.ClassLoader classLoader)
classLoader
- The class loader for loading this value.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object