Class AnnotationValue.ForConstant<U>
java.lang.Object
net.bytebuddy.description.annotation.AnnotationValue.AbstractBase<U,U>
net.bytebuddy.description.annotation.AnnotationValue.ForConstant<U>
- Type Parameters:
U
- The type where primitive values are represented by their boxed type.
- All Implemented Interfaces:
AnnotationValue<U,
U>
- Enclosing interface:
AnnotationValue<T,
S>
Represents a primitive value, a
String
or an array of the latter types.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Represents a trivial loaded value.protected static interface
A property delegate for a constant annotation value.Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationValue
AnnotationValue.AbstractBase<U,
V>, AnnotationValue.ForAnnotationDescription<U extends Annotation>, AnnotationValue.ForConstant<U>, AnnotationValue.ForDescriptionArray<U, V>, AnnotationValue.ForEnumerationDescription<U extends Enum<U>>, AnnotationValue.ForIncompatibleType<U, V>, AnnotationValue.ForMismatchedType<U, V>, AnnotationValue.ForMissingType<U, V>, AnnotationValue.ForMissingValue<U, V>, AnnotationValue.ForTypeDescription<U extends Class<U>>, AnnotationValue.RenderingDispatcher, AnnotationValue.Sort, AnnotationValue.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AnnotationValue.ForConstant.PropertyDelegate
The property delegate for the value's type.private final U
The represented value.Fields inherited from interface net.bytebuddy.description.annotation.AnnotationValue
UNDEFINED
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForConstant
(U value, AnnotationValue.ForConstant.PropertyDelegate propertyDelegate) Creates a new constant annotation value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
filter
(MethodDescription.InDefinedShape property, TypeDefinition typeDefinition) Filters this annotation value as a valid value of the provided property.getSort()
Returns the property type of the annotation value.getState()
Returns the state of the represented annotation value.int
hashCode()
load
(ClassLoader classLoader) Returns the loaded value of this annotation.static AnnotationValue
<Boolean, Boolean> of
(boolean value) Creates an annotation value for aboolean
value.static AnnotationValue
<boolean[], boolean[]> of
(boolean... value) Creates an annotation value for aboolean[]
value.static AnnotationValue
<Byte, Byte> of
(byte value) Creates an annotation value for abyte
value.static AnnotationValue
<byte[], byte[]> of
(byte... value) Creates an annotation value for abyte[]
value.static AnnotationValue
<Character, Character> of
(char value) Creates an annotation value for achar
value.static AnnotationValue
<char[], char[]> of
(char... value) Creates an annotation value for achar[]
value.static AnnotationValue
<Double, Double> of
(double value) Creates an annotation value for adouble
value.static AnnotationValue
<double[], double[]> of
(double... value) Creates an annotation value for adouble[]
value.static AnnotationValue
<Float, Float> of
(float value) Creates an annotation value for afloat
value.static AnnotationValue
<float[], float[]> of
(float... value) Creates an annotation value for afloat[]
value.static AnnotationValue
<Integer, Integer> of
(int value) Creates an annotation value for aint
value.static AnnotationValue
<int[], int[]> of
(int... value) Creates an annotation value for aint[]
value.static AnnotationValue
<Long, Long> of
(long value) Creates an annotation value for along
value.static AnnotationValue
<long[], long[]> of
(long... value) Creates an annotation value for along[]
value.static AnnotationValue
<Short, Short> of
(short value) Creates an annotation value for ashort
value.static AnnotationValue
<short[], short[]> of
(short... value) Creates an annotation value for ashort[]
value.static AnnotationValue
<?, ?> Creates an annotation value for any constant value, i.e any primitive (wrapper) type, any primitive array type or anyString
value or array.static AnnotationValue
<String, String> Creates an annotation value for aString
value.static AnnotationValue
<String[], String[]> Creates an annotation value for aString[]
value.resolve()
Resolves the unloaded value of this annotation.toString()
Methods inherited from class net.bytebuddy.description.annotation.AnnotationValue.AbstractBase
filter, resolve
-
Field Details
-
value
The represented value. -
propertyDelegate
The property delegate for the value's type.
-
-
Constructor Details
-
ForConstant
Creates a new constant annotation value.- Parameters:
value
- The represented value.propertyDelegate
- The property delegate for the value's type.
-
-
Method Details
-
of
Creates an annotation value for aboolean
value.- Parameters:
value
- Theboolean
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for abyte
value.- Parameters:
value
- Thebyte
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for ashort
value.- Parameters:
value
- Theshort
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for achar
value.- Parameters:
value
- Thechar
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for aint
value.- Parameters:
value
- Theint
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for along
value.- Parameters:
value
- Thelong
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for afloat
value.- Parameters:
value
- Thefloat
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for adouble
value.- Parameters:
value
- Thedouble
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for aString
value.- Parameters:
value
- TheString
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for aboolean[]
value.- Parameters:
value
- Theboolean[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for abyte[]
value.- Parameters:
value
- Thebyte[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for ashort[]
value.- Parameters:
value
- Theshort[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for achar[]
value.- Parameters:
value
- Thechar[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for aint[]
value.- Parameters:
value
- Theint[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for along[]
value.- Parameters:
value
- Thelong[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for afloat[]
value.- Parameters:
value
- Thefloat[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for adouble[]
value.- Parameters:
value
- Thedouble[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for aString[]
value.- Parameters:
value
- TheString[]
value to represent.- Returns:
- An appropriate annotation value.
-
of
Creates an annotation value for any constant value, i.e any primitive (wrapper) type, any primitive array type or anyString
value or array. If no constant annotation type is provided, a runtime exception is thrown.- Parameters:
value
- The value to represent.- Returns:
- An appropriate annotation value.
-
getState
Returns the state of the represented annotation value.- Returns:
- The state represented by this instance.
-
getSort
Returns the property type of the annotation value.- Returns:
- The property type of the annotation value.
-
filter
public AnnotationValue<U,U> filter(MethodDescription.InDefinedShape property, TypeDefinition typeDefinition) Filters this annotation value as a valid value of the provided property.- Parameters:
property
- The property to filter against.typeDefinition
- The expected type.- Returns:
- This annotation value or a new annotation value that describes why this value is not a valid value for the supplied property.
-
resolve
Resolves the unloaded value of this annotation. The return value of this method is not defined if this annotation value is invalid.- Returns:
- The unloaded value of this annotation.
-
load
Returns the loaded value of this annotation.- Parameters:
classLoader
- The class loader for loading this value ornull
for using the boot loader.- Returns:
- The loaded value of this annotation.
-
hashCode
-
equals
-
toString
-