Class DefaultAnnotationMetadata
- All Implemented Interfaces:
AnnotationMetadata,AnnotationSource,Cloneable
- Direct Known Subclasses:
MutableAnnotationMetadata
AnnotationMetadata.
NOTE: Although required to be public This is an internal class and should not be referenced directly in user code
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs empty annotation metadata.DefaultAnnotationMetadata(@Nullable Map<String, Map<CharSequence, Object>> declaredAnnotations, @Nullable Map<String, Map<CharSequence, Object>> declaredStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allAnnotations, @Nullable Map<String, List<String>> annotationsByStereotype) This constructor is designed to be used by compile time produced subclasses.DefaultAnnotationMetadata(@Nullable Map<String, Map<CharSequence, Object>> declaredAnnotations, @Nullable Map<String, Map<CharSequence, Object>> declaredStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allAnnotations, @Nullable Map<String, List<String>> annotationsByStereotype, boolean hasPropertyExpressions) This constructor is designed to be used by compile time produced subclasses.DefaultAnnotationMetadata(@Nullable Map<String, Map<CharSequence, Object>> declaredAnnotations, @Nullable Map<String, Map<CharSequence, Object>> declaredStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allAnnotations, @Nullable Map<String, List<String>> annotationsByStereotype, boolean hasPropertyExpressions, boolean hasEvaluatedExpressions) This constructor is designed to be used by compile time produced subclasses. -
Method Summary
Modifier and TypeMethodDescriptionbooleanValue(Class<? extends Annotation> annotation, String member) The value as an optional boolean for the given annotation and member.booleanValue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the boolean value and optionally map its value.booleanValue(String annotation, String member) The value as an optional boolean for the given annotation and member.Retrieve the boolean value and optionally map its value.classValue(Class<? extends Annotation> annotation, String member) The value of the annotation as a Class.classValue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.classValue(String annotation, String member) The value of the annotation as a Class.Retrieve the class value and optionally map its value.<T> Class<T>[]classValues(Class<? extends Annotation> annotation, String member) The value of the annotation as a Class.<T> Class<T>[]classValues(String annotation, String member) The value of the annotation as a Class.clone()protected final <K,V> Map <K, V> cloneMapOfListValue(Map<K, List<V>> toClone) cloneMapOfMapValue(Map<K, Map<X, Y>> toClone) Makes a copy of the annotation or returns this.doubleValue(Class<? extends Annotation> annotation, String member) The value as anOptionalDoublefor the given annotation and member.doubleValue(Class<? extends Annotation> annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the double value and optionally map its value.doubleValue(String annotation, String member) The value as anOptionalDoublefor the given annotation and member.Retrieve the double value and optionally map its value.enumValue(Class<? extends Annotation> annotation, Class<E> enumType) The value of the annotation as a Class.enumValue(Class<? extends Annotation> annotation, String member, Class<E> enumType) The value of the annotation as a Class.enumValue(Class<? extends Annotation> annotation, String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.The value of the given enum.The value of the annotation as a Class.enumValue(String annotation, String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.<E extends Enum<E>>
E[]enumValues(Class<? extends Annotation> annotation, Class<E> enumType) The enum values for the given annotation.<E extends Enum<E>>
E[]enumValues(Class<? extends Annotation> annotation, String member, Class<E> enumType) The enum values for the given annotation.<E extends Enum<E>>
E[]enumValues(Class<? extends Annotation> annotation, String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) <E extends Enum<E>>
E[]enumValues(String annotation, Class<E> enumType) The enum values for the given annotation.<E extends Enum<E>>
E[]enumValues(String annotation, String member, Class<E> enumType) The enum values for the given annotation.<E extends Enum<E>>
E[]enumValues(String annotation, String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) <T extends Annotation>
Optional<AnnotationValue<T>> findAnnotation(String annotation) Find anAnnotationValuefor the given annotation name.<T extends Annotation>
Optional<AnnotationValue<T>> findDeclaredAnnotation(String annotation) Get all values for the given annotation that are directly declared on the annotated element.findRepeatableAnnotation(Class<? extends Annotation> annotation) Find repeatable annotation container.findRepeatableAnnotation(String annotation) Find repeatable annotation container.protected @Nullable StringfindRepeatableAnnotationContainerInternal(String annotation) Find annotation's repeatable container.getAnnotationNameByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.All the annotation names this metadata declares.getAnnotationNamesByStereotype(@Nullable String stereotype) Resolve all annotation names that feature the given stereotype.Optional<Class<? extends Annotation>> getAnnotationType(String name) Gets the type for a given annotation if it is present on the classpath.Optional<Class<? extends Annotation>> getAnnotationType(String name, ClassLoader classLoader) Gets the type for a given annotation if it is present on the classpath.Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(@Nullable String stereotype) Find the first annotation name for the given stereotype.<T extends Annotation>
List<AnnotationValue<T>> getAnnotationValuesByName(String annotationType) Gets all the annotation values by the given repeatable type name.<T extends Annotation>
List<AnnotationValue<T>> getAnnotationValuesByStereotype(String stereotype) Resolve all annotation values that feature the given stereotype.<T extends Annotation>
List<AnnotationValue<T>> getAnnotationValuesByType(@Nullable Class<T> annotationType) Gets all the annotation values by the given repeatable type.All the declared annotation names this metadata declares.getDeclaredAnnotationNamesByStereotype(@Nullable String stereotype) Resolve all annotations names for the given stereotype that are declared annotations.<T extends Annotation>
List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(String annotationType) Gets only declared annotation values by the given repeatable type name.<T extends Annotation>
List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(Class<T> annotationType) Gets only declared annotation values by the given repeatable type.Gets the declared metadata without inherited metdata.Returns the names of the annotations which are declared stereotypes.<T> Optional<T> getDefaultValue(String annotation, String member, Argument<T> requiredType) Return the default value for the given annotation member.<T> Optional<T> getDefaultValue(String annotation, String member, Class<T> requiredType) Return the default value for the given annotation member.getDefaultValues(String annotation) Return the default values for the given annotation name.Returns the names of the annotations which are stereotypes.<T> Optional<T> getValue(Class<? extends Annotation> annotation, String member, Class<T> requiredType) Get the value of the given annotation member.<T> Optional<T> Get the value of the given annotation member.<T> Optional<T> getValue(String annotation, String member, Argument<T> requiredType, @Nullable Function<Object, Object> valueMapper) Resolves the given value performing type conversion as necessary.Get all values for the given annotation and type of the underlying values.<T> OptionalValues<T> Get all values for the given annotation and type of the underlying values.booleanhasAnnotation(String annotation) Checks whether this object has the given annotation on the object itself or inherited from a parent.booleanhasDeclaredAnnotation(Class<? extends Annotation> annotation) Checks whether this object has the given annotation directly declared on the object.booleanhasDeclaredAnnotation(String annotation) Checks whether this object has the given annotation directly declared on the object.booleanhasDeclaredStereotype(String annotation) Checks whether this object has the given annotation stereotype on the object itself and not inherited from a parentbooleanDoes the metadata contain any evaluated expressions like#{ T(java.lang.Math).random() }.booleanDoes the metadata contain any property expressions like${foo.bar}.booleanhasStereotype(Class<? extends Annotation> annotation) Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentbooleanhasStereotype(String annotation) Checks whether this object has the given annotation stereotype on the object itself or inherited from a parentintValue(Class<? extends Annotation> annotation, String member) The value as anOptionalIntfor the given annotation and member.intValue(Class<? extends Annotation> annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the int value and optionally map its value.The value as anOptionalIntfor the given annotation and member.Retrieve the int value and optionally map its value.booleanisEmpty()Is the annotation metadata empty.booleanReturns whether the value of the given member is true.booleanReturns whether the value of the given member is present.booleanisRepeatableAnnotation(Class<? extends Annotation> annotation) Is repeatable annotation?booleanisRepeatableAnnotation(String annotation) Is repeatable annotation?booleanisTrue(Class<? extends Annotation> annotation, String member) Returns whether the value of the given member is true.booleanRetrieve the boolean value and optionally map its value.booleanReturns whether the value of the given member is true.booleanRetrieve the boolean value and optionally map its value.longValue(Class<? extends Annotation> annotation, String member) The value as anOptionalLongfor the given annotation and member.longValue(Class<? extends Annotation> annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the long value and optionally map its value.The value as anOptionalLongfor the given annotation and member.Retrieve the long value and optionally map its value.protected <T extends Annotation>
AnnotationValue<T> newAnnotationValue(String annotationType, Map<CharSequence, Object> values) static voidregisterAnnotationDefaults(AnnotationClassValue<?> annotation, Map<CharSequence, Object> defaultValues) Registers annotation default values.static voidregisterAnnotationDefaults(String annotation, Map<CharSequence, Object> defaultValues) Registers annotation default values.static voidregisterAnnotationType(AnnotationClassValue<?> annotation) Registers annotation default values.static voidregisterRepeatableAnnotations(Map<String, String> repeatableAnnotations) Registers repeatable annotations.stringValue(Class<? extends Annotation> annotation, String member) The value as an optional string for the given annotation and member.stringValue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the string value and optionally map its value.stringValue(String annotation, String member) The value as an optional string for the given annotation and member.Retrieve the string value and optionally map its value.String[]stringValues(Class<? extends Annotation> annotation, String member) The values as string array for the given annotation and member.String[]stringValues(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the string value and optionally map its value.String[]stringValues(String annotation, String member) The values as string array for the given annotation and member.String[]Retrieve the string value and optionally map its value.<T extends Annotation>
@Nullable Tsynthesize(Class<T> annotationClass) Synthesizes a new annotation from the metadata for the given annotation type.<T extends Annotation>
@Nullable Tsynthesize(Class<T> annotationClass, String sourceAnnotation) Synthesizes a new annotation for the given annotation type using the member values of the given source annotation.Synthesizes a new annotations from the metadata.<T extends Annotation>
T[]synthesizeAnnotationsByType(Class<T> annotationClass) Synthesizes a new annotations from the metadata for the given type.Synthesizes a new annotations from the metadata.<T extends Annotation>
@Nullable TsynthesizeDeclared(Class<T> annotationClass) Synthesizes a new annotation from the metadata for the given annotation type.<T extends Annotation>
@Nullable TsynthesizeDeclared(Class<T> annotationClass, String sourceAnnotation) Synthesizes a new annotation declared for the given annotation type using the member values of the given source annotation.<T extends Annotation>
T[]synthesizeDeclaredAnnotationsByType(Class<T> annotationClass) Synthesizes a new annotations from the metadata for the given type.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
booleanValue, booleanValue, classValue, classValue, classValues, classValues, doubleValue, enumValuesSet, enumValuesSet, findAnnotation, findDeclaredAnnotation, getAnnotationNameByStereotype, getAnnotationNamesByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDefaultValue, getDefaultValue, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, hasAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotypeNonRepeating, intValue, isAnnotationPresent, isAnnotationPresent, isDeclaredAnnotationPresent, isDeclaredAnnotationPresent, isFalse, isPresent, stringValue, stringValue, stringValues, stringValuesMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, synthesize, synthesize, synthesizeAll, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared
-
Constructor Details
-
DefaultAnnotationMetadata
Constructs empty annotation metadata. -
DefaultAnnotationMetadata
@Internal public DefaultAnnotationMetadata(@Nullable Map<String, Map<CharSequence, Object>> declaredAnnotations, @Nullable Map<String, Map<CharSequence, Object>> declaredStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allAnnotations, @Nullable Map<String, List<String>> annotationsByStereotype) This constructor is designed to be used by compile time produced subclasses.- Parameters:
declaredAnnotations- The directly declared annotationsdeclaredStereotypes- The directly declared stereotypesallStereotypes- All stereotypesallAnnotations- All annotationsannotationsByStereotype- The annotations by stereotype
-
DefaultAnnotationMetadata
@Internal public DefaultAnnotationMetadata(@Nullable Map<String, Map<CharSequence, Object>> declaredAnnotations, @Nullable Map<String, Map<CharSequence, Object>> declaredStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allAnnotations, @Nullable Map<String, List<String>> annotationsByStereotype, boolean hasPropertyExpressions) This constructor is designed to be used by compile time produced subclasses.- Parameters:
declaredAnnotations- The directly declared annotationsdeclaredStereotypes- The directly declared stereotypesallStereotypes- All stereotypesallAnnotations- All annotationsannotationsByStereotype- The annotations by stereotypehasPropertyExpressions- Whether property expressions exist in the metadata
-
DefaultAnnotationMetadata
@Internal public DefaultAnnotationMetadata(@Nullable Map<String, Map<CharSequence, Object>> declaredAnnotations, @Nullable Map<String, Map<CharSequence, Object>> declaredStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allStereotypes, @Nullable Map<String, Map<CharSequence, Object>> allAnnotations, @Nullable Map<String, List<String>> annotationsByStereotype, boolean hasPropertyExpressions, boolean hasEvaluatedExpressions) This constructor is designed to be used by compile time produced subclasses.- Parameters:
declaredAnnotations- The directly declared annotationsdeclaredStereotypes- The directly declared stereotypesallStereotypes- All stereotypesallAnnotations- All annotationsannotationsByStereotype- The annotations by stereotypehasPropertyExpressions- Whether property expressions exist in the metadatahasEvaluatedExpressions- Whether evaluated expressions exist in the metadata
-
-
Method Details
-
getDeclaredMetadata
Description copied from interface:AnnotationMetadataGets the declared metadata without inherited metdata.- Specified by:
getDeclaredMetadatain interfaceAnnotationMetadata- Returns:
- The declared metadata
-
hasPropertyExpressions
public boolean hasPropertyExpressions()Description copied from interface:AnnotationMetadataDoes the metadata contain any property expressions like${foo.bar}. Note this by default returnstrueas previous versions of Micronaut must assume metadata is present. The compilation time this is computed in order to decide whether to instrument annotation metadata with environment specific logic.- Specified by:
hasPropertyExpressionsin interfaceAnnotationMetadata- Returns:
- True if property expressions are present
-
hasEvaluatedExpressions
public boolean hasEvaluatedExpressions()Description copied from interface:AnnotationMetadataDoes the metadata contain any evaluated expressions like#{ T(java.lang.Math).random() }.- Specified by:
hasEvaluatedExpressionsin interfaceAnnotationMetadata- Returns:
- True if evaluated expressions are present
-
getDefaultValues
Description copied from interface:AnnotationMetadataReturn the default values for the given annotation name.- Specified by:
getDefaultValuesin interfaceAnnotationMetadata- Parameters:
annotation- The annotation name- Returns:
- The default values
-
isPresent
Description copied from interface:AnnotationMetadataReturns whether the value of the given member is present.- Specified by:
isPresentin interfaceAnnotationMetadata- Parameters:
annotation- The annotation classmember- The annotation member- Returns:
- True if the value is true
-
enumValue
Description copied from interface:AnnotationMetadataThe value of the given enum.- Specified by:
enumValuein interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationenumType- The enum type- Returns:
- An
Optionalenum value
-
enumValue
public <E extends Enum<E>> Optional<E> enumValue(String annotation, String member, Class<E> enumType) Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
enumValuein interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationmember- The annotation memberenumType- The enum type- Returns:
- An
Optionalclass
-
enumValue
public <E extends Enum<E>> Optional<E> enumValue(Class<? extends Annotation> annotation, Class<E> enumType) Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
enumValuein interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationenumType- The enum type- Returns:
- An
Optionalclass
-
enumValue
public <E extends Enum<E>> Optional<E> enumValue(Class<? extends Annotation> annotation, String member, Class<E> enumType) Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
enumValuein interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationmember- The annotation memberenumType- The enum type- Returns:
- An
Optionalclass
-
enumValue
@Internal public <E extends Enum<E>> Optional<E> enumValue(Class<? extends Annotation> annotation, String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationmember- The memberenumType- The enum typevalueMapper- The value mapper- Returns:
- The class value
-
enumValues
Description copied from interface:AnnotationMetadataThe enum values for the given annotation.- Specified by:
enumValuesin interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationenumType- The enum type- Returns:
- An array of enum values
-
enumValues
Description copied from interface:AnnotationMetadataThe enum values for the given annotation.- Specified by:
enumValuesin interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationmember- The annotation memberenumType- The enum type- Returns:
- An array of enum values
-
enumValues
public <E extends Enum<E>> E[] enumValues(Class<? extends Annotation> annotation, Class<E> enumType) Description copied from interface:AnnotationMetadataThe enum values for the given annotation.- Specified by:
enumValuesin interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationenumType- The enum type- Returns:
- An array of enum values
-
enumValues
public <E extends Enum<E>> E[] enumValues(Class<? extends Annotation> annotation, String member, Class<E> enumType) Description copied from interface:AnnotationMetadataThe enum values for the given annotation.- Specified by:
enumValuesin interfaceAnnotationMetadata- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationmember- The annotation memberenumType- The enum type- Returns:
- An array of enum values
-
enumValues
-
enumValues
-
enumValue
@Internal public <E extends Enum<E>> Optional<E> enumValue(String annotation, String member, Class<E> enumType, @Nullable Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.- Type Parameters:
E- The enum type- Parameters:
annotation- The annotationmember- The memberenumType- The enum typevalueMapper- The value mapper- Returns:
- The class value
-
classValues
Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
classValuesin interfaceAnnotationMetadata- Type Parameters:
T- The type of the class- Parameters:
annotation- The annotationmember- The annotation member- Returns:
- An
Optionalclass
-
classValues
Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
classValuesin interfaceAnnotationMetadata- Type Parameters:
T- The type of the class- Parameters:
annotation- The annotationmember- The annotation member- Returns:
- An
Optionalclass
-
classValue
Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
classValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The annotation member- Returns:
- An
Optionalclass
-
classValue
public Optional<Class> classValue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The class value
-
classValue
Description copied from interface:AnnotationMetadataThe value of the annotation as a Class.- Specified by:
classValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The annotation member- Returns:
- An
Optionalclass
-
classValue
@Internal public Optional<Class> classValue(String annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the class value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The class value
-
intValue
Description copied from interface:AnnotationMetadataThe value as anOptionalIntfor the given annotation and member.- Specified by:
intValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalIntvalue
-
intValue
Description copied from interface:AnnotationMetadataThe value as anOptionalIntfor the given annotation and member.- Specified by:
intValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalIntvalue
-
intValue
@Internal public OptionalInt intValue(Class<? extends Annotation> annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the int value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The int value
-
booleanValue
Description copied from interface:AnnotationMetadataThe value as an optional boolean for the given annotation and member.- Specified by:
booleanValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- The string value if it is present
-
booleanValue
Description copied from interface:AnnotationMetadataThe value as an optional boolean for the given annotation and member.- Specified by:
booleanValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- The string value if it is present
-
booleanValue
public Optional<Boolean> booleanValue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the boolean value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The boolean value
-
booleanValue
public Optional<Boolean> booleanValue(String annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the boolean value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The boolean value
-
longValue
Description copied from interface:AnnotationMetadataThe value as anOptionalLongfor the given annotation and member.- Specified by:
longValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalLongvalue
-
longValue
Description copied from interface:AnnotationMetadataThe value as anOptionalLongfor the given annotation and member.- Specified by:
longValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalLongvalue
-
longValue
@Internal public OptionalLong longValue(Class<? extends Annotation> annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the long value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The long value
-
longValue
public OptionalLong longValue(String annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the long value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The long value
-
intValue
public OptionalInt intValue(String annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the int value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The int value
-
stringValue
Description copied from interface:AnnotationMetadataThe value as an optional string for the given annotation and member.- Specified by:
stringValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- The string value if it is present
-
stringValue
public Optional<String> stringValue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the string value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The int value
-
stringValues
Description copied from interface:AnnotationMetadataThe values as string array for the given annotation and member.- Specified by:
stringValuesin interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- The string values if it is present
-
stringValues
Description copied from interface:AnnotationMetadataThe values as string array for the given annotation and member.- Specified by:
stringValuesin interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- The string values if it is present
-
stringValues
public String[] stringValues(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the string value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The int value
-
stringValues
Retrieve the string value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The int value
-
stringValue
Description copied from interface:AnnotationMetadataThe value as an optional string for the given annotation and member.- Specified by:
stringValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- The string value if it is present
-
stringValue
public Optional<String> stringValue(String annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the string value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The string value
-
isTrue
Description copied from interface:AnnotationMetadataReturns whether the value of the given member is true.- Specified by:
isTruein interfaceAnnotationMetadata- Parameters:
annotation- The annotation classmember- The annotation member- Returns:
- True if the value is true
-
isTrue
public boolean isTrue(Class<? extends Annotation> annotation, String member, Function<Object, Object> valueMapper) Retrieve the boolean value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The boolean value
-
isTrue
Description copied from interface:AnnotationMetadataReturns whether the value of the given member is true.- Specified by:
isTruein interfaceAnnotationMetadata- Parameters:
annotation- The annotation classmember- The annotation member- Returns:
- True if the value is true
-
isTrue
public boolean isTrue(String annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the boolean value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The boolean value
-
isFalse
Description copied from interface:AnnotationMetadataReturns whether the value of the given member is true.- Specified by:
isFalsein interfaceAnnotationMetadata- Parameters:
annotation- The annotation classmember- The annotation member- Returns:
- True if the value is true
-
doubleValue
Description copied from interface:AnnotationMetadataThe value as anOptionalDoublefor the given annotation and member.- Specified by:
doubleValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalDoublevalue
-
doubleValue
Description copied from interface:AnnotationMetadataThe value as anOptionalDoublefor the given annotation and member.- Specified by:
doubleValuein interfaceAnnotationMetadata- Parameters:
annotation- The annotationmember- The member- Returns:
- THe
OptionalDoublevalue
-
doubleValue
@Internal public OptionalDouble doubleValue(Class<? extends Annotation> annotation, String member, @Nullable Function<Object, Object> valueMapper) Retrieve the double value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The double value
-
doubleValue
@Internal public OptionalDouble doubleValue(String annotation, String member, Function<Object, Object> valueMapper) Retrieve the double value and optionally map its value.- Parameters:
annotation- The annotationmember- The membervalueMapper- The value mapper- Returns:
- The double value
-
getValue
public <T> Optional<T> getValue(Class<? extends Annotation> annotation, String member, Class<T> requiredType) Description copied from interface:AnnotationMetadataGet the value of the given annotation member.- Specified by:
getValuein interfaceAnnotationMetadata- Type Parameters:
T- The value- Parameters:
annotation- The annotation classmember- The annotation memberrequiredType- The required type- Returns:
- An
Optionalof the value
-
getValue
Description copied from interface:AnnotationMetadataGet the value of the given annotation member.- Specified by:
getValuein interfaceAnnotationMetadata- Type Parameters:
T- The value- Parameters:
annotation- The annotation classmember- The annotation memberrequiredType- The required type- Returns:
- An
Optionalof the value
-
getValue
public <T> Optional<T> getValue(String annotation, String member, Argument<T> requiredType, @Nullable Function<Object, Object> valueMapper) Resolves the given value performing type conversion as necessary.- Type Parameters:
T- The generic type- Parameters:
annotation- The annotationmember- The memberrequiredType- The required typevalueMapper- The value mapper- Returns:
- The resolved value
-
getDefaultValue
Description copied from interface:AnnotationMetadataReturn the default value for the given annotation member.- Specified by:
getDefaultValuein interfaceAnnotationMetadata- Type Parameters:
T- The required generic type- Parameters:
annotation- The annotationmember- The memberrequiredType- The required type- Returns:
- An optional value
-
getAnnotationValuesByType
public <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByType(@Nullable Class<T> annotationType) Description copied from interface:AnnotationMetadataGets all the annotation values by the given repeatable type.- Specified by:
getAnnotationValuesByTypein interfaceAnnotationMetadata- Type Parameters:
T- The annotation type- Parameters:
annotationType- The annotation type- Returns:
- A list of values
-
getAnnotationValuesByName
public <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByName(String annotationType) Description copied from interface:AnnotationMetadataGets all the annotation values by the given repeatable type name.- Specified by:
getAnnotationValuesByNamein interfaceAnnotationMetadata- Type Parameters:
T- The annotation type- Parameters:
annotationType- The annotation type- Returns:
- A list of values
-
newAnnotationValue
protected <T extends Annotation> AnnotationValue<T> newAnnotationValue(String annotationType, Map<CharSequence, Object> values) -
getDeclaredAnnotationValuesByType
public <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(Class<T> annotationType) Description copied from interface:AnnotationMetadataGets only declared annotation values by the given repeatable type.- Specified by:
getDeclaredAnnotationValuesByTypein interfaceAnnotationMetadata- Type Parameters:
T- The annotation type- Parameters:
annotationType- The annotation type- Returns:
- A list of values
-
getDeclaredAnnotationValuesByName
public <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(String annotationType) Description copied from interface:AnnotationMetadataGets only declared annotation values by the given repeatable type name.- Specified by:
getDeclaredAnnotationValuesByNamein interfaceAnnotationMetadata- Type Parameters:
T- The annotation type- Parameters:
annotationType- The annotation type- Returns:
- A list of values
-
synthesizeAnnotationsByType
Description copied from interface:AnnotationSourceSynthesizes a new annotations from the metadata for the given type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeAnnotationsByTypein interfaceAnnotationSource- Type Parameters:
T- The annotation generic type- Parameters:
annotationClass- The annotation type- Returns:
- All annotations by the given type
-
synthesizeDeclaredAnnotationsByType
Description copied from interface:AnnotationSourceSynthesizes a new annotations from the metadata for the given type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeDeclaredAnnotationsByTypein interfaceAnnotationSource- Type Parameters:
T- The annotation generic type- Parameters:
annotationClass- The annotation type- Returns:
- Declared annotations by the given type
-
isEmpty
public boolean isEmpty()Description copied from interface:AnnotationMetadataIs the annotation metadata empty.- Specified by:
isEmptyin interfaceAnnotationMetadata- Returns:
- True if it is
-
hasDeclaredAnnotation
Description copied from interface:AnnotationMetadataChecks whether this object has the given annotation directly declared on the object.- Specified by:
hasDeclaredAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- True if the annotation is present
-
hasAnnotation
Description copied from interface:AnnotationMetadataChecks whether this object has the given annotation on the object itself or inherited from a parent.- Specified by:
hasAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- True if the annotation is present
-
hasStereotype
Description copied from interface:AnnotationMetadataChecks whether this object has the given annotation stereotype on the object itself or inherited from a parent
.An annotation stereotype is a meta annotation potentially applied to another annotation
- Specified by:
hasStereotypein interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- True if the annotation is present
-
hasStereotype
Description copied from interface:AnnotationMetadataChecks whether this object has the given annotation stereotype on the object itself or inherited from a parent
.An annotation stereotype is a meta annotation potentially applied to another annotation
- Specified by:
hasStereotypein interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredStereotype
Description copied from interface:AnnotationMetadataChecks whether this object has the given annotation stereotype on the object itself and not inherited from a parent
.An annotation stereotype is a meta annotation potentially applied to another annotation
- Specified by:
hasDeclaredStereotypein interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- True if the annotation is present
-
hasDeclaredAnnotation
Description copied from interface:AnnotationMetadataChecks whether this object has the given annotation directly declared on the object.- Specified by:
hasDeclaredAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- True if the annotation is present
-
getAnnotationTypeByStereotype
public Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(@Nullable String stereotype) Description copied from interface:AnnotationMetadataFind the first annotation name for the given stereotype.- Specified by:
getAnnotationTypeByStereotypein interfaceAnnotationMetadata- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getAnnotationNameByStereotype
Description copied from interface:AnnotationMetadataFind the first annotation name for the given stereotype.- Specified by:
getAnnotationNameByStereotypein interfaceAnnotationMetadata- Parameters:
stereotype- The stereotype- Returns:
- The annotation name
-
getAnnotationNamesByStereotype
Description copied from interface:AnnotationMetadataResolve all annotation names that feature the given stereotype.- Specified by:
getAnnotationNamesByStereotypein interfaceAnnotationMetadata- Parameters:
stereotype- The annotation names- Returns:
- A set of annotation names
-
getAnnotationValuesByStereotype
public <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByStereotype(String stereotype) Description copied from interface:AnnotationMetadataResolve all annotation values that feature the given stereotype.- Specified by:
getAnnotationValuesByStereotypein interfaceAnnotationMetadata- Type Parameters:
T- The annotation type- Parameters:
stereotype- The annotation names- Returns:
- A set of annotation names
-
getAnnotationNames
Description copied from interface:AnnotationMetadataAll the annotation names this metadata declares.- Specified by:
getAnnotationNamesin interfaceAnnotationMetadata- Returns:
- All the annotation names this metadata declares
-
getStereotypeAnnotationNames
Description copied from interface:AnnotationMetadataReturns the names of the annotations which are stereotypes.A stereotype is a meta-annotation (an annotation declared on another annotation).
- Specified by:
getStereotypeAnnotationNamesin interfaceAnnotationMetadata- Returns:
- The names of the stereotype annotations
- See Also:
-
getDeclaredStereotypeAnnotationNames
Description copied from interface:AnnotationMetadataReturns the names of the annotations which are declared stereotypes.A stereotype is a meta-annotation (an annotation declared on another annotation).
A stereotype is considered declared when it it is a meta-annotation that is present on an annotation directly declared on the element and not inherited from a super class.
- Specified by:
getDeclaredStereotypeAnnotationNamesin interfaceAnnotationMetadata- Returns:
- The names of the stereotype annotations
- See Also:
-
getDeclaredAnnotationNames
Description copied from interface:AnnotationMetadataAll the declared annotation names this metadata declares.- Specified by:
getDeclaredAnnotationNamesin interfaceAnnotationMetadata- Returns:
- All the declared annotation names this metadata declares
-
getDeclaredAnnotationNamesByStereotype
Description copied from interface:AnnotationMetadataResolve all annotations names for the given stereotype that are declared annotations.- Specified by:
getDeclaredAnnotationNamesByStereotypein interfaceAnnotationMetadata- Parameters:
stereotype- The stereotype- Returns:
- The declared annotations
-
getAnnotationType
Description copied from interface:AnnotationMetadataGets the type for a given annotation if it is present on the classpath. Subclasses can potentially override to provide optimized loading.- Specified by:
getAnnotationTypein interfaceAnnotationMetadata- Parameters:
name- The type name- Returns:
- The type if present
-
getAnnotationType
public Optional<Class<? extends Annotation>> getAnnotationType(String name, ClassLoader classLoader) Description copied from interface:AnnotationMetadataGets the type for a given annotation if it is present on the classpath. Subclasses can potentially override to provide optimized loading.- Specified by:
getAnnotationTypein interfaceAnnotationMetadata- Parameters:
name- The type nameclassLoader- The ClassLoader to load the type- Returns:
- The type if present
-
findAnnotation
Description copied from interface:AnnotationSourceFind anAnnotationValuefor the given annotation name.- Specified by:
findAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotation- The annotation name- Returns:
- A
AnnotationValueinstance
-
findDeclaredAnnotation
public <T extends Annotation> Optional<AnnotationValue<T>> findDeclaredAnnotation(String annotation) Description copied from interface:AnnotationSourceGet all values for the given annotation that are directly declared on the annotated element.- Specified by:
findDeclaredAnnotationin interfaceAnnotationSource- Type Parameters:
T- The annotation type- Parameters:
annotation- The annotation name- Returns:
- A
AnnotationValueinstance
-
getValues
Description copied from interface:AnnotationMetadataGet all values for the given annotation and type of the underlying values.- Specified by:
getValuesin interfaceAnnotationMetadata- Type Parameters:
T- Generic type- Parameters:
annotation- The annotation namevalueType- valueType- Returns:
- The
OptionalValues
-
getValues
Description copied from interface:AnnotationMetadataGet all values for the given annotation and type of the underlying values.- Specified by:
getValuesin interfaceAnnotationMetadata- Parameters:
annotation- The annotation name- Returns:
- An immutable map of values
-
getDefaultValue
Description copied from interface:AnnotationMetadataReturn the default value for the given annotation member.- Specified by:
getDefaultValuein interfaceAnnotationMetadata- Type Parameters:
T- The required generic type- Parameters:
annotation- The annotationmember- The memberrequiredType- The required type- Returns:
- An optional value
-
isRepeatableAnnotation
Description copied from interface:AnnotationMetadataIs repeatable annotation?- Specified by:
isRepeatableAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- true if repeatable
-
isRepeatableAnnotation
Description copied from interface:AnnotationMetadataIs repeatable annotation?- Specified by:
isRepeatableAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- true if repeatable
-
findRepeatableAnnotation
Description copied from interface:AnnotationMetadataFind repeatable annotation container.- Specified by:
findRepeatableAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- optional repeatable annotation container
-
findRepeatableAnnotation
Description copied from interface:AnnotationMetadataFind repeatable annotation container.- Specified by:
findRepeatableAnnotationin interfaceAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- optional repeatable annotation container
-
copyAnnotationMetadata
Description copied from interface:AnnotationMetadataMakes a copy of the annotation or returns this.- Specified by:
copyAnnotationMetadatain interfaceAnnotationMetadata- Returns:
- the copy
-
clone
-
cloneMapOfMapValue
-
cloneMapOfListValue
-
cloneMap
-
registerAnnotationDefaults
@Internal public static void registerAnnotationDefaults(String annotation, Map<CharSequence, Object> defaultValues) Registers annotation default values. Used by generated byte code. DO NOT REMOVE.- Parameters:
annotation- The annotation namedefaultValues- The default values
-
registerAnnotationDefaults
@Internal public static void registerAnnotationDefaults(AnnotationClassValue<?> annotation, Map<CharSequence, Object> defaultValues) Registers annotation default values. Used by generated byte code. DO NOT REMOVE.- Parameters:
annotation- The annotation namedefaultValues- The default values
-
registerAnnotationType
Registers annotation default values. Used by generated byte code. DO NOT REMOVE.- Parameters:
annotation- The annotation
-
registerRepeatableAnnotations
@Internal public static void registerRepeatableAnnotations(Map<String, String> repeatableAnnotations) Registers repeatable annotations. Annotation container -> annotations item. Used by generated byte code. DO NOT REMOVE.- Parameters:
repeatableAnnotations- The annotation
-
findRepeatableAnnotationContainerInternal
Find annotation's repeatable container.- Parameters:
annotation- The annotation- Returns:
- the repeatable container or null
-
synthesize
Description copied from interface:AnnotationSourceSynthesizes a new annotation from the metadata for the given annotation type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizein interfaceAnnotationSource- Type Parameters:
T- The annotation generic type- Parameters:
annotationClass- The annotation class- Returns:
- The annotation or null if it doesn't exist
-
synthesize
public <T extends Annotation> @Nullable T synthesize(Class<T> annotationClass, String sourceAnnotation) Description copied from interface:AnnotationSourceSynthesizes a new annotation for the given annotation type using the member values of the given source annotation.This method allows supporting synthesizing annotations that have been renamed, for example a
jakarta.inject.Namedannotation an be synthesized from the metadata of the ajakarta.inject.Namedannotation.- Specified by:
synthesizein interfaceAnnotationSource- Type Parameters:
T- The annotation generic type- Parameters:
annotationClass- The annotation classsourceAnnotation- The source annotation that provides the member values- Returns:
- The annotation or null if it doesn't exist
-
synthesizeDeclared
public <T extends Annotation> @Nullable T synthesizeDeclared(Class<T> annotationClass, String sourceAnnotation) Description copied from interface:AnnotationSourceSynthesizes a new annotation declared for the given annotation type using the member values of the given source annotation.This method allows supporting synthesizing annotations that have been renamed, for example a
jakarta.inject.Namedannotation an be synthesized from the metadata of the ajakarta.inject.Namedannotation.- Specified by:
synthesizeDeclaredin interfaceAnnotationSource- Type Parameters:
T- The annotation generic type- Parameters:
annotationClass- The annotation classsourceAnnotation- The source annotation that provides the member values- Returns:
- The annotation or null if it doesn't exist
-
synthesizeDeclared
Description copied from interface:AnnotationSourceSynthesizes a new annotation from the metadata for the given annotation type. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.This method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)
- Specified by:
synthesizeDeclaredin interfaceAnnotationSource- Type Parameters:
T- The annotation generic type- Parameters:
annotationClass- The annotation class- Returns:
- The annotation or null if it doesn't exist
-
synthesizeAll
Description copied from interface:AnnotationSourceSynthesizes a new annotations from the metadata. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeAllin interfaceAnnotationSource- Returns:
- All the annotations
-
synthesizeDeclared
Description copied from interface:AnnotationSourceSynthesizes a new annotations from the metadata. This method works by creating a runtime proxy of the annotation interface and should be avoided in favour of direct use of the annotation metadata and only used for unique cases that require integrating third party libraries.- Specified by:
synthesizeDeclaredin interfaceAnnotationSource- Returns:
- All declared annotations
-