Package io.micronaut.core.annotation
Class AnnotationValue<A extends Annotation>
java.lang.Object
io.micronaut.core.annotation.AnnotationValue<A>
- Type Parameters:
A
- The annotation type
- All Implemented Interfaces:
AnnotationValueResolver
,ValueResolver<CharSequence>
- Direct Known Subclasses:
EvaluatedAnnotationValue
public class AnnotationValue<A extends Annotation>
extends Object
implements AnnotationValueResolver
A runtime representation of the annotation and its values.
This class implements the AnnotationValueResolver
interface and methods such as ValueResolver.get(CharSequence, Class)
can be used to retrieve the values of annotation members.
If a member is not present then the methods of the class will attempt to resolve the default value for a given annotation member. In this sense the behaviour of this class is similar to how
a implementation of Annotation
behaves.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
ConstructorDescriptionAnnotationValue
(AnnotationValue<A> target, Map<CharSequence, Object> defaultValues, ConvertibleValues<Object> convertibleValues, Function<Object, Object> valueMapper) AnnotationValue
(String annotationName) AnnotationValue
(String annotationName, ConvertibleValues<Object> convertibleValues) AnnotationValue
(String annotationName, Map<CharSequence, Object> values) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, AnnotationDefaultValuesProvider defaultValuesProvider) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, RetentionPolicy retentionPolicy) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, RetentionPolicy retentionPolicy, List<AnnotationValue<?>> stereotypes) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues, RetentionPolicy retentionPolicy) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues, RetentionPolicy retentionPolicy, List<AnnotationValue<?>> stereotypes) AnnotationValue
(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues, RetentionPolicy retentionPolicy, List<AnnotationValue<?>> stereotypes, AnnotationDefaultValuesProvider defaultValuesProvider) -
Method Summary
Modifier and TypeMethodDescriptionannotationClassValue
(@NonNull String member) TheAnnotationClassValue
instance for the given member.annotationClassValues
(@NonNull String member) TheAnnotationClassValue
instances for the given member.booleanValue
(@NonNull String member) The boolean value of the given member.The boolean value of the given member.boolean[]
booleanValues
(String member) The boolean[] value for the given member.static <T extends Annotation>
AnnotationValueBuilder<T>builder
(@NonNull AnnotationValue<T> annotation) Start building a new annotation existing value.static <T extends Annotation>
AnnotationValueBuilder<T>builder
(@NonNull AnnotationValue<T> annotation, @Nullable RetentionPolicy retentionPolicy) Start building a new annotation existing value and retention policy.static <T extends Annotation>
AnnotationValueBuilder<T>Start building a new annotation for the given name.static <T extends Annotation>
AnnotationValueBuilder<T>Start building a new annotation for the given name.static <T extends Annotation>
AnnotationValueBuilder<T>builder
(String annotationName, RetentionPolicy retentionPolicy) Start building a new annotation for the given name.The byte value of the given member.byte[]
byteValues
(String member) The byte[] value for the given member.The char value of the given member.char[]
charValues
(String member) The char[] value for the given member.The value of the annotation as a Class.classValue
(@NonNull String member) The value of the given annotation member as a Class.classValue
(@NonNull String member, @NonNull Class<T> requiredType) The value of the given annotation member as a Class.The value of the given annotation member as a Class.Class<?>[]
classValues
(@NonNull String member) The value of the given annotation member as a Class.final boolean
Whether a particular member is present.The double value of the given member.doubleValue
(@NonNull String member) The double value of the given member.The double value of the given member.double[]
doubleValues
(String member) The double[] value for the given member.Return the enum value of the given member of the given enum type.Return the enum value of the given member of the given enum type.<E extends Enum>
E[]enumValues
(@NonNull String member, @NonNull Class<E> enumType) Return the enum values of the given member of the given enum type.boolean
The double value of the given member.floatValue
(String member) The double value of the given member.float[]
floatValues
(String member) The float[] value for the given member.<T> Optional<T>
get
(CharSequence member, ArgumentConversionContext<T> conversionContext) Resolve the given property for the given name.<T extends Annotation>
@NonNull Optional<AnnotationValue<T>>getAnnotation
(@NonNull String member) Gets a list ofAnnotationValue
for the given member.<T extends Annotation>
@NonNull Optional<AnnotationValue<T>>getAnnotation
(String member, Class<T> type) Gets a list ofAnnotationValue
for the given member.The annotation name.<T extends Annotation>
@NonNull List<AnnotationValue<T>>getAnnotations
(String member) Gets a list ofAnnotationValue
for the given member.<T extends Annotation>
@NonNull List<AnnotationValue<T>>getAnnotations
(String member, Class<T> type) Gets a list ofAnnotationValue
for the given member.The default values.final @NonNull Set<CharSequence>
Resolves the names of all the present annotation members.getProperties
(@NonNull String member) Resolves a map of properties for a member that is an array of annotations that have members called "name" or "key" to represent the key and "value" to represent the value.getProperties
(@NonNull String member, String keyMember) Resolve properties with a custom key member.final <T> T
getRequiredValue
(Class<T> type) Get the value of thevalue
member of the annotation.final <T> T
getRequiredValue
(String member, Class<T> type) Get the value of thevalue
member of the annotation.final @NonNull RetentionPolicy
<T> Optional<T>
getValue
(ArgumentConversionContext<T> conversionContext) Get the value of thevalue
member of the annotation.final <T> Optional<T>
Get the value of thevalue
member of the annotation.final <T> Optional<T>
Get the value of thevalue
member of the annotation.boolean
If this AnnotationValue contains Evaluated Expressions.int
hashCode()
intValue()
The integer value of the given member.The integer value of the given member.The integer value of the given member.int[]
The int[] value for the given member.boolean
isFalse()
boolean
final boolean
isPresent
(CharSequence member) Is the given member present.boolean
isTrue()
boolean
boolean
The long value of the given member.The long value of the given member.long[]
longValues
(String member) The long[] value for the given member.mutate()
Creates a builder with the initial value of this annotation.resolveClassValues
(@Nullable Object value) The class values for the given value.resolveEnumValues
(@NonNull Class<E> enumType, @Nullable Object rawValue) The enum values for the given enum type and raw value.static String[]
The string[] values for the given value.The string values for the given value.shortValue
(@NonNull String member) The short value of the given member.The short value of the given member.short[]
shortValues
(String member) The short[] value for the given member.The double value of the given member.stringValue
(@NonNull String member) The string value of the given member.The string value of the given member.stringValues
(@NonNull String member) The string values for the given member.String[]
The string values for the given member and mapper.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotationValueResolver
booleanValue, booleanValues, byteValue, byteValues, charValue, charValues, classValues, doubleValues, enumValue, enumValues, enumValuesSet, floatValue, floatValues, intValues, longValue, longValues, shortValue, shortValues, stringValues
Methods inherited from interface io.micronaut.core.value.ValueResolver
get, get, get
-
Constructor Details
-
AnnotationValue
- Parameters:
annotationName
- The annotation namevalues
- The values
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, RetentionPolicy retentionPolicy) - Parameters:
annotationName
- The annotation namevalues
- The valuesretentionPolicy
- The retention policy
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, RetentionPolicy retentionPolicy, List<AnnotationValue<?>> stereotypes) - Parameters:
annotationName
- The annotation namevalues
- The valuesretentionPolicy
- The retention policystereotypes
- The stereotypes of the annotation
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues) - Parameters:
annotationName
- The annotation namevalues
- The valuesdefaultValues
- The default values
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, AnnotationDefaultValuesProvider defaultValuesProvider) - Parameters:
annotationName
- The annotation namevalues
- The valuesdefaultValuesProvider
- The default values provider- Since:
- 4.2.0
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues, RetentionPolicy retentionPolicy) - Parameters:
annotationName
- The annotation namevalues
- The valuesdefaultValues
- The default valuesretentionPolicy
- The retention policy
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues, RetentionPolicy retentionPolicy, List<AnnotationValue<?>> stereotypes) - Parameters:
annotationName
- The annotation namevalues
- The valuesdefaultValues
- The default valuesretentionPolicy
- The retention policystereotypes
- The stereotypes of the annotation
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, Map<CharSequence, Object> values, Map<CharSequence, Object> defaultValues, RetentionPolicy retentionPolicy, List<AnnotationValue<?>> stereotypes, AnnotationDefaultValuesProvider defaultValuesProvider) - Parameters:
annotationName
- The annotation namevalues
- The valuesdefaultValues
- The default valuesretentionPolicy
- The retention policystereotypes
- The stereotypes of the annotationdefaultValuesProvider
- The defaults values provider
-
AnnotationValue
- Parameters:
annotationName
- The annotation name
-
AnnotationValue
@Internal public AnnotationValue(String annotationName, ConvertibleValues<Object> convertibleValues) - Parameters:
annotationName
- The annotation nameconvertibleValues
- The convertible values
-
AnnotationValue
@Internal public AnnotationValue(AnnotationValue<A> target, Map<CharSequence, Object> defaultValues, ConvertibleValues<Object> convertibleValues, Function<Object, Object> valueMapper) - Parameters:
target
- The targetdefaultValues
- The default valuesconvertibleValues
- The convertible valuesvalueMapper
- The value mapper
-
-
Method Details
-
getValueMapper
- Returns:
- The value mapper.
- Since:
- 4.0.2
-
mutate
Creates a builder with the initial value of this annotation.- Returns:
- The builder with this annotation value
- Since:
- 4.0.0
-
getRetentionPolicy
- Returns:
- The retention policy.
-
getStereotypes
- Returns:
- The stereotypes of the annotation
-
getDefaultValues
The default values.- Returns:
- The default of the annotation or null if not specified.
- Since:
- 4.0.0
-
getProperties
Resolves a map of properties for a member that is an array of annotations that have members called "name" or "key" to represent the key and "value" to represent the value.For example consider the following annotation definition:
@PropertySource({ @Property(name = "one", value = "1"), @Property(name = "two", value = "2")}) public class MyBean { ... }
You can use this method to resolve the values of the
PropertySource
annotation such that the following assertion is true:annotationValue.getProperties("value") == [one:1, two:2]
- Parameters:
member
- The member- Returns:
- The properties as an immutable map.
-
getProperties
Resolve properties with a custom key member.- Parameters:
member
- The member to resolve the properties fromkeyMember
- The member of the sub annotation that represents the key.- Returns:
- The properties.
- See Also:
-
enumValue
public <E extends Enum> Optional<E> enumValue(@NonNull @NonNull String member, @NonNull @NonNull Class<E> enumType) Return the enum value of the given member of the given enum type.- Specified by:
enumValue
in interfaceAnnotationValueResolver
- Type Parameters:
E
- The enum type- Parameters:
member
- The annotation memberenumType
- The required type- Returns:
- An
Optional
of the enum value
-
enumValue
public <E extends Enum> Optional<E> enumValue(@NonNull @NonNull String member, @NonNull @NonNull Class<E> enumType, Function<Object, Object> valueMapper) Return the enum value of the given member of the given enum type.- Type Parameters:
E
- The enum type- Parameters:
member
- The annotation memberenumType
- The required typevalueMapper
- The value mapper- Returns:
- An
Optional
of the enum value
-
enumValues
public <E extends Enum> E[] enumValues(@NonNull @NonNull String member, @NonNull @NonNull Class<E> enumType) Return the enum values of the given member of the given enum type.- Specified by:
enumValues
in interfaceAnnotationValueResolver
- Type Parameters:
E
- The enum type- Parameters:
member
- The annotation memberenumType
- The required type- Returns:
- An array of enum values
-
classValue
The value of the annotation as a Class.- Specified by:
classValue
in interfaceAnnotationValueResolver
- Returns:
- An
Optional
class
-
classValue
The value of the given annotation member as a Class.- Specified by:
classValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
Optional
class
-
classValue
public <T> Optional<Class<? extends T>> classValue(@NonNull @NonNull String member, @NonNull @NonNull Class<T> requiredType) The value of the given annotation member as a Class.- Specified by:
classValue
in interfaceAnnotationValueResolver
- Type Parameters:
T
- The required type- Parameters:
member
- The annotation memberrequiredType
- The required type- Returns:
- An
Optional
class
-
classValue
public Optional<Class<?>> classValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The value of the given annotation member as a Class.- Parameters:
member
- The annotation membervalueMapper
- The raw value mapper- Returns:
- An
Optional
class
-
stringValues
Description copied from interface:AnnotationValueResolver
The string values for the given member.- Specified by:
stringValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
String
-
booleanValues
Description copied from interface:AnnotationValueResolver
The boolean[] value for the given member.- Specified by:
booleanValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
boolean
-
byteValues
Description copied from interface:AnnotationValueResolver
The byte[] value for the given member.- Specified by:
byteValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
byte
-
charValues
Description copied from interface:AnnotationValueResolver
The char[] value for the given member.- Specified by:
charValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
char
-
intValues
Description copied from interface:AnnotationValueResolver
The int[] value for the given member.- Specified by:
intValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
int
-
doubleValues
Description copied from interface:AnnotationValueResolver
The double[] value for the given member.- Specified by:
doubleValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
double
-
longValues
Description copied from interface:AnnotationValueResolver
The long[] value for the given member.- Specified by:
longValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
long
-
floatValues
Description copied from interface:AnnotationValueResolver
The float[] value for the given member.- Specified by:
floatValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
float
-
shortValues
Description copied from interface:AnnotationValueResolver
The short[] value for the given member.- Specified by:
shortValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of
short
-
stringValues
The string values for the given member and mapper.- Parameters:
member
- The membervalueMapper
- The mapper- Returns:
- The string values
-
classValues
Description copied from interface:AnnotationValueResolver
The value of the given annotation member as a Class.- Specified by:
classValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of classes
-
annotationClassValues
@NonNull public @NonNull AnnotationClassValue<?>[] annotationClassValues(@NonNull @NonNull String member) Description copied from interface:AnnotationValueResolver
TheAnnotationClassValue
instances for the given member. UnlikeAnnotationValueResolver.classValues(String)
this may include classes that are no the classpath.- Specified by:
annotationClassValues
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An array of class values
-
annotationClassValue
Description copied from interface:AnnotationValueResolver
TheAnnotationClassValue
instance for the given member.- Specified by:
annotationClassValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An annotation class value
-
intValue
The integer value of the given member.- Specified by:
intValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
OptionalInt
-
intValue
public OptionalInt intValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The integer value of the given member.- Parameters:
member
- The annotation membervalueMapper
- The value mapper- Returns:
- An
OptionalInt
-
byteValue
Description copied from interface:AnnotationValueResolver
The byte value of the given member.- Specified by:
byteValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
Optional
ofByte
-
charValue
Description copied from interface:AnnotationValueResolver
The char value of the given member.- Specified by:
charValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
Optional
ofCharacter
-
intValue
The integer value of the given member.- Specified by:
intValue
in interfaceAnnotationValueResolver
- Returns:
- An
OptionalInt
-
longValue
Description copied from interface:AnnotationValueResolver
The long value of the given member.- Specified by:
longValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
OptionalLong
-
longValue
public OptionalLong longValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The long value of the given member.- Parameters:
member
- The annotation membervalueMapper
- The value mapper- Returns:
- An
OptionalLong
-
shortValue
Description copied from interface:AnnotationValueResolver
The short value of the given member.- Specified by:
shortValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
Optional
ofShort
-
shortValue
public Optional<Short> shortValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The short value of the given member. -
booleanValue
public Optional<Boolean> booleanValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The boolean value of the given member.- Parameters:
member
- The annotation membervalueMapper
- The value mapper- Returns:
- An
Optional
boolean
-
doubleValue
The double value of the given member.- Specified by:
doubleValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
OptionalDouble
-
doubleValue
public OptionalDouble doubleValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The double value of the given member.- Parameters:
member
- The annotation membervalueMapper
- The value mapper- Returns:
- An
OptionalDouble
-
floatValue
Description copied from interface:AnnotationValueResolver
The double value of the given member.- Specified by:
floatValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
OptionalDouble
-
floatValue
public Optional<Float> floatValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The double value of the given member.- Parameters:
member
- The annotation membervalueMapper
- The value mapper- Returns:
- An
OptionalDouble
-
doubleValue
The double value of the given member.- Specified by:
doubleValue
in interfaceAnnotationValueResolver
- Returns:
- An
OptionalDouble
-
stringValue
The string value of the given member.- Specified by:
stringValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
OptionalInt
-
stringValue
public Optional<String> stringValue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) The string value of the given member.- Parameters:
member
- The annotation membervalueMapper
- An optional raw value mapper- Returns:
- An
OptionalInt
-
stringValue
The double value of the given member.- Specified by:
stringValue
in interfaceAnnotationValueResolver
- Returns:
- An
OptionalInt
-
booleanValue
Description copied from interface:AnnotationValueResolver
The boolean value of the given member.- Specified by:
booleanValue
in interfaceAnnotationValueResolver
- Parameters:
member
- The annotation member- Returns:
- An
Optional
boolean
-
isPresent
Is the given member present.- Specified by:
isPresent
in interfaceAnnotationValueResolver
- Parameters:
member
- The member- Returns:
- True if it is
-
isTrue
public boolean isTrue()- Specified by:
isTrue
in interfaceAnnotationValueResolver
- Returns:
- Is the value of the annotation true.
-
isTrue
- Specified by:
isTrue
in interfaceAnnotationValueResolver
- Parameters:
member
- The member- Returns:
- Is the value of the annotation true.
-
isTrue
public boolean isTrue(@NonNull @NonNull String member, @Nullable @Nullable Function<Object, Object> valueMapper) - Parameters:
member
- The membervalueMapper
- The value mapper- Returns:
- Is the value of the annotation true.
-
isFalse
public boolean isFalse()- Specified by:
isFalse
in interfaceAnnotationValueResolver
- Returns:
- Is the value of the annotation true.
-
isFalse
- Specified by:
isFalse
in interfaceAnnotationValueResolver
- Parameters:
member
- The member- Returns:
- Is the value of the annotation true.
-
getAnnotationName
The annotation name.- Returns:
- The annotation name
-
contains
Whether a particular member is present.- Parameters:
member
- The member- Returns:
- True if it is
-
getMemberNames
Resolves the names of all the present annotation members.- Returns:
- The names of the members
-
getValues
- Specified by:
getValues
in interfaceAnnotationValueResolver
- Returns:
- The attribute values
-
getConvertibleValues
- Returns:
- The convertible values
-
get
Description copied from interface:ValueResolver
Resolve the given property for the given name.- Specified by:
get
in interfaceValueResolver<A extends Annotation>
- Type Parameters:
T
- The concrete type- Parameters:
member
- The nameconversionContext
- The conversion context- Returns:
- An optional containing the property value if it exists and is able to be converted
-
getValue
Get the value of thevalue
member of the annotation.- Type Parameters:
T
- The type- Parameters:
conversionContext
- The conversion context- Returns:
- The result
-
getValue
Get the value of thevalue
member of the annotation.- Type Parameters:
T
- The type- Parameters:
argument
- The argument- Returns:
- The result
-
getValue
Get the value of thevalue
member of the annotation.- Type Parameters:
T
- The type- Parameters:
type
- The type- Returns:
- The result
-
getRequiredValue
Get the value of thevalue
member of the annotation.- Type Parameters:
T
- The type- Parameters:
type
- The type- Returns:
- The result
- Throws:
IllegalStateException
- If no member is available that conforms to the given type
-
getRequiredValue
Get the value of thevalue
member of the annotation.- Type Parameters:
T
- The type- Parameters:
member
- The membertype
- The type- Returns:
- The result
- Throws:
IllegalStateException
- If no member is available that conforms to the given name and type
-
getAnnotations
@NonNull public <T extends Annotation> @NonNull List<AnnotationValue<T>> getAnnotations(String member, Class<T> type) Gets a list ofAnnotationValue
for the given member.- Type Parameters:
T
- The type- Parameters:
member
- The membertype
- The type- Returns:
- The result
- Throws:
IllegalStateException
- If no member is available that conforms to the given name and type
-
getAnnotations
@NonNull public <T extends Annotation> @NonNull List<AnnotationValue<T>> getAnnotations(String member) Gets a list ofAnnotationValue
for the given member.- Type Parameters:
T
- The type- Parameters:
member
- The member- Returns:
- The result
- Throws:
IllegalStateException
- If no member is available that conforms to the given name and type
-
getAnnotation
@NonNull public <T extends Annotation> @NonNull Optional<AnnotationValue<T>> getAnnotation(String member, Class<T> type) Gets a list ofAnnotationValue
for the given member.- Type Parameters:
T
- The type- Parameters:
member
- The membertype
- The type- Returns:
- The result
- Throws:
IllegalStateException
- If no member is available that conforms to the given name and type
-
getAnnotation
@NonNull public <T extends Annotation> @NonNull Optional<AnnotationValue<T>> getAnnotation(@NonNull @NonNull String member) Gets a list ofAnnotationValue
for the given member.- Type Parameters:
T
- The type- Parameters:
member
- The member- Returns:
- The result
- Throws:
IllegalStateException
- If no member is available that conforms to the given name and type- Since:
- 3.3.0
-
hasEvaluatedExpressions
public boolean hasEvaluatedExpressions()If this AnnotationValue contains Evaluated Expressions.- Returns:
- true if it is
- Since:
- 4.0.0
-
toString
-
hashCode
public int hashCode() -
equals
-
builder
Start building a new annotation for the given name.- Type Parameters:
T
- The annotation type- Parameters:
annotationName
- The annotation name- Returns:
- The builder
-
builder
public static <T extends Annotation> AnnotationValueBuilder<T> builder(String annotationName, RetentionPolicy retentionPolicy) Start building a new annotation for the given name.- Type Parameters:
T
- The annotation type- Parameters:
annotationName
- The annotation nameretentionPolicy
- The retention policy- Returns:
- The builder
- Since:
- 2.4.0
-
builder
Start building a new annotation for the given name.- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation name- Returns:
- The builder
-
builder
public static <T extends Annotation> AnnotationValueBuilder<T> builder(@NonNull @NonNull AnnotationValue<T> annotation) Start building a new annotation existing value.- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation name- Returns:
- The builder
- Since:
- 4.0.0
-
builder
public static <T extends Annotation> AnnotationValueBuilder<T> builder(@NonNull @NonNull AnnotationValue<T> annotation, @Nullable @Nullable RetentionPolicy retentionPolicy) Start building a new annotation existing value and retention policy.- Type Parameters:
T
- The annotation type- Parameters:
annotation
- The annotation nameretentionPolicy
- The retention policy. Defaults to runtime.- Returns:
- The builder
-
resolveStringValues
@Internal @Nullable public static @Nullable String[] resolveStringValues(@Nullable @Nullable Object value, @Nullable @Nullable Function<Object, Object> valueMapper) The string values for the given value.- Parameters:
value
- The valuevalueMapper
- The value mapper- Returns:
- The string[] or null
-
resolveEnumValues
@Internal @NonNull public static <E extends Enum> @NonNull E[] resolveEnumValues(@NonNull @NonNull Class<E> enumType, @Nullable @Nullable Object rawValue) The enum values for the given enum type and raw value.- Type Parameters:
E
- The enum generic type- Parameters:
enumType
- The enum typerawValue
- The raw value- Returns:
- An array of enum values
-
resolveStringArray
@Internal public static String[] resolveStringArray(String[] strs, @Nullable @Nullable Function<Object, Object> valueMapper) The string[] values for the given value.- Parameters:
strs
- The stringsvalueMapper
- The value mapper- Returns:
- The string[] or the original string
-
resolveClassValues
@Internal @Nullable public static @Nullable Class<?>[] resolveClassValues(@Nullable @Nullable Object value) The class values for the given value.- Parameters:
value
- The value- Returns:
- The class values or null
-