@Internal public class DefaultAnnotationMetadata extends Object implements AnnotationMetadata, Cloneable
AnnotationMetadata.
NOTE: Although required to be public This is an internal class and should not be referenced directly in user code
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Annotation> |
annotationMap |
protected Map<String,Annotation> |
declaredAnnotationMap |
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Modifier | Constructor and Description |
|---|---|
protected |
DefaultAnnotationMetadata()
Constructs empty annotation metadata.
|
|
DefaultAnnotationMetadata(Map<String,Map<CharSequence,Object>> declaredAnnotations,
Map<String,Map<CharSequence,Object>> declaredStereotypes,
Map<String,Map<CharSequence,Object>> allStereotypes,
Map<String,Map<CharSequence,Object>> allAnnotations,
Map<String,List<String>> annotationsByStereotype)
This constructor is designed to be used by compile time produced subclasses.
|
|
DefaultAnnotationMetadata(Map<String,Map<CharSequence,Object>> declaredAnnotations,
Map<String,Map<CharSequence,Object>> declaredStereotypes,
Map<String,Map<CharSequence,Object>> allStereotypes,
Map<String,Map<CharSequence,Object>> allAnnotations,
Map<String,List<String>> annotationsByStereotype,
boolean hasPropertyExpressions)
This constructor is designed to be used by compile time produced subclasses.
|
|
DefaultAnnotationMetadata(Map<String,Map<CharSequence,Object>> declaredAnnotations,
Map<String,Map<CharSequence,Object>> declaredStereotypes,
Map<String,Map<CharSequence,Object>> allStereotypes,
Map<String,Map<CharSequence,Object>> allAnnotations,
Map<String,List<String>> annotationsByStereotype,
boolean hasPropertyExpressions,
boolean useRepeatableDefaults)
This constructor is designed to be used by compile time produced subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAnnotation(String annotation,
Map<CharSequence,Object> values)
Adds an annotation and its member values, if the annotation already exists the data will be merged with existing
values replaced.
|
protected void |
addAnnotation(String annotation,
Map<CharSequence,Object> values,
RetentionPolicy retentionPolicy)
Adds an annotation and its member values, if the annotation already exists the data will be merged with existing
values replaced.
|
protected void |
addAnnotationValuesFromData(List results,
Map<CharSequence,Object> values)
Adds any annotation values found in the values map to the results.
|
protected void |
addDeclaredAnnotation(String annotation,
Map<CharSequence,Object> values)
Adds an annotation directly declared on the element and its member values, if the annotation already exists the
data will be merged with existing values replaced.
|
protected void |
addDeclaredAnnotation(String annotation,
Map<CharSequence,Object> values,
RetentionPolicy retentionPolicy)
Adds an annotation directly declared on the element and its member values, if the annotation already exists the
data will be merged with existing values replaced.
|
protected void |
addDeclaredRepeatable(String annotationName,
AnnotationValue annotationValue)
Adds a repeatable annotation value.
|
protected void |
addDeclaredRepeatable(String annotationName,
AnnotationValue annotationValue,
RetentionPolicy retentionPolicy)
Adds a repeatable annotation value.
|
protected void |
addDeclaredRepeatableStereotype(List<String> parents,
String stereotype,
AnnotationValue annotationValue)
Adds a repeatable declared stereotype value.
|
protected void |
addDeclaredStereotype(List<String> parentAnnotations,
String stereotype,
Map<CharSequence,Object> values)
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing
values replaced.
|
protected void |
addDeclaredStereotype(List<String> parentAnnotations,
String stereotype,
Map<CharSequence,Object> values,
RetentionPolicy retentionPolicy)
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing
values replaced.
|
protected void |
addDefaultAnnotationValues(String annotation,
Map<CharSequence,Object> values)
Adds an annotation directly declared on the element and its member values, if the annotation already exists the
data will be merged with existing values replaced.
|
protected void |
addRepeatable(String annotationName,
AnnotationValue annotationValue)
Adds a repeatable annotation value.
|
protected void |
addRepeatable(String annotationName,
AnnotationValue annotationValue,
RetentionPolicy retentionPolicy)
Adds a repeatable annotation value.
|
protected void |
addRepeatableStereotype(List<String> parents,
String stereotype,
AnnotationValue annotationValue)
Adds a repeatable stereotype value.
|
protected void |
addStereotype(List<String> parentAnnotations,
String stereotype,
Map<CharSequence,Object> values)
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing
values replaced.
|
protected void |
addStereotype(List<String> parentAnnotations,
String stereotype,
Map<CharSequence,Object> values,
RetentionPolicy retentionPolicy)
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing
values replaced.
|
protected void |
addValuesToResults(List<AnnotationValue> results,
AnnotationValue values)
Adds a values instance to the results.
|
static boolean |
areAnnotationDefaultsRegistered(String annotation)
Returns whether annotation defaults are registered for the give annotation.
|
Optional<Boolean> |
booleanValue(Class<? extends Annotation> annotation,
String member)
The value as an optional boolean for the given annotation and member.
|
Optional<Boolean> |
booleanValue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the boolean value and optionally map its value.
|
Optional<Boolean> |
booleanValue(String annotation,
String member)
The value as an optional boolean for the given annotation and member.
|
Optional<Boolean> |
booleanValue(String annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the boolean value and optionally map its value.
|
Optional<Class> |
classValue(Class<? extends Annotation> annotation,
String member)
The value of the annotation as a Class.
|
Optional<Class> |
classValue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the class value and optionally map its value.
|
Optional<Class> |
classValue(String annotation,
String member)
The value of the annotation as a Class.
|
Optional<Class> |
classValue(String annotation,
String member,
Function<Object,Object> valueMapper)
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.
|
DefaultAnnotationMetadata |
clone() |
static void |
contributeDefaults(AnnotationMetadata target,
AnnotationMetadata source)
Contributes defaults to the given target.
|
static void |
contributeRepeatable(AnnotationMetadata target,
AnnotationMetadata source)
Contributes repeatable annotation metadata to the given target.
|
static void |
contributeRepeatable(AnnotationMetadata target,
ClassElement classElement)
Contributes repeatable annotation metadata to the given class element.
|
OptionalDouble |
doubleValue(Class<? extends Annotation> annotation,
String member)
The value as an
OptionalDouble for the given annotation and member. |
OptionalDouble |
doubleValue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the double value and optionally map its value.
|
OptionalDouble |
doubleValue(String annotation,
String member)
The value as an
OptionalDouble for the given annotation and member. |
OptionalDouble |
doubleValue(String annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the double value and optionally map its value.
|
<E extends Enum> |
enumValue(Class<? extends Annotation> annotation,
Class<E> enumType)
The value of the annotation as a Class.
|
<E extends Enum> |
enumValue(Class<? extends Annotation> annotation,
String member,
Class<E> enumType)
The value of the annotation as a Class.
|
<E extends Enum> |
enumValue(Class<? extends Annotation> annotation,
String member,
Class<E> enumType,
Function<Object,Object> valueMapper)
Retrieve the class value and optionally map its value.
|
<E extends Enum> |
enumValue(String annotation,
Class<E> enumType)
The value of the given enum.
|
<E extends Enum> |
enumValue(String annotation,
String member,
Class<E> enumType)
The value of the annotation as a Class.
|
<E extends Enum> |
enumValue(String annotation,
String member,
Class<E> enumType,
Function<Object,Object> valueMapper)
Retrieve the class value and optionally map its value.
|
<E extends Enum> |
enumValues(Class<? extends Annotation> annotation,
Class<E> enumType)
The enum values for the given annotation.
|
<E extends Enum> |
enumValues(Class<? extends Annotation> annotation,
String member,
Class<E> enumType)
The enum values for the given annotation.
|
<E extends Enum> |
enumValues(Class<? extends Annotation> annotation,
String member,
Class<E> enumType,
Function<Object,Object> valueMapper)
Retrieve the enum values and optionally map its value.
|
<E extends Enum> |
enumValues(String annotation,
Class<E> enumType)
The enum values for the given annotation.
|
<E extends Enum> |
enumValues(String annotation,
String member,
Class<E> enumType)
The enum values for the given annotation.
|
<E extends Enum> |
enumValues(String annotation,
String member,
Class<E> enumType,
Function<Object,Object> valueMapper)
Retrieve the enum values and optionally map its value.
|
<T extends Annotation> |
findAnnotation(String annotation)
Find an
AnnotationValue for the given annotation name. |
<T extends Annotation> |
findDeclaredAnnotation(String annotation)
Get all of the values for the given annotation that are directly declared on the annotated element.
|
Optional<String> |
findRepeatableAnnotation(Class<? extends Annotation> annotation)
Find repeatable annotation container.
|
Optional<String> |
findRepeatableAnnotation(String annotation)
Find repeatable annotation container.
|
Optional<String> |
getAnnotationNameByStereotype(String stereotype)
Find the first annotation name for the given stereotype.
|
Set<String> |
getAnnotationNames()
All the annotation names this metadata declares.
|
List<String> |
getAnnotationNamesByStereotype(String stereotype)
Resolve all of the 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(String stereotype)
Find the first annotation name for the given stereotype.
|
<T extends Annotation> |
getAnnotationValuesByName(String annotationType)
Gets all the annotation values by the given repeatable type name.
|
<T extends Annotation> |
getAnnotationValuesByType(Class<T> annotationType)
Gets all the annotation values by the given repeatable type.
|
Set<String> |
getDeclaredAnnotationNames()
All the declared annotation names this metadata declares.
|
List<String> |
getDeclaredAnnotationNamesByStereotype(String stereotype)
Resolve all of the annotations names for the given stereotype that are declared annotations.
|
<T extends Annotation> |
getDeclaredAnnotationValuesByName(String annotationType)
Gets only declared annotation values by the given repeatable type name.
|
<T extends Annotation> |
getDeclaredAnnotationValuesByType(Class<T> annotationType)
Gets only declared annotation values by the given repeatable type.
|
AnnotationMetadata |
getDeclaredMetadata()
Gets the declared metadata without inherited metdata.
|
Set<String> |
getDeclaredStereotypeAnnotationNames()
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.
|
Map<String,Object> |
getDefaultValues(String annotation)
Return the default values for the given annotation name.
|
Set<String> |
getStereotypeAnnotationNames()
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> |
getValue(String annotation,
String member,
Argument<T> requiredType)
Get the value of the given annotation member.
|
<T> Optional<T> |
getValue(String annotation,
String member,
Argument<T> requiredType,
Function<Object,Object> valueMapper)
Resolves the given value performing type conversion as necessary.
|
Map<CharSequence,Object> |
getValues(String annotation)
Get all of the values for the given annotation and type of the underlying values.
|
<T> OptionalValues<T> |
getValues(String annotation,
Class<T> valueType)
Get all of the values for the given annotation and type of the underlying values.
|
boolean |
hasAnnotation(String annotation)
Checks whether this object has the given annotation on the object itself or inherited from a parent.
|
boolean |
hasDeclaredAnnotation(String annotation)
Checks whether this object has the given annotation directly declared on the object.
|
boolean |
hasDeclaredStereotype(String annotation)
Checks whether this object has the given annotation stereotype on the object itself and not inherited from a parent
|
boolean |
hasPropertyExpressions()
Does the metadata contain any property expressions like
${foo.bar}. |
boolean |
hasStereotype(String annotation)
Checks whether this object has the given annotation stereotype on the object itself or inherited from a parent
|
OptionalInt |
intValue(Class<? extends Annotation> annotation,
String member)
The value as an
OptionalInt for the given annotation and member. |
OptionalInt |
intValue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the int value and optionally map its value.
|
OptionalInt |
intValue(String annotation,
String member)
The value as an
OptionalInt for the given annotation and member. |
OptionalInt |
intValue(String annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the int value and optionally map its value.
|
boolean |
isEmpty()
Is the annotation metadata empty.
|
boolean |
isFalse(String annotation,
String member)
Returns whether the value of the given member is true.
|
boolean |
isPresent(String annotation,
String member)
Returns whether the value of the given member is present.
|
boolean |
isRepeatableAnnotation(Class<? extends Annotation> annotation)
Is repeatable annotation?
|
boolean |
isRepeatableAnnotation(String annotation)
Is repeatable annotation?
|
boolean |
isTrue(Class<? extends Annotation> annotation,
String member)
Returns whether the value of the given member is true.
|
boolean |
isTrue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the boolean value and optionally map its value.
|
boolean |
isTrue(String annotation,
String member)
Returns whether the value of the given member is true.
|
boolean |
isTrue(String annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the boolean value and optionally map its value.
|
OptionalLong |
longValue(Class<? extends Annotation> annotation,
String member)
The value as an
OptionalLong for the given annotation and member. |
OptionalLong |
longValue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the long value and optionally map its value.
|
OptionalLong |
longValue(String annotation,
String member)
The value as an
OptionalLong for the given annotation and member. |
OptionalLong |
longValue(String annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the long value and optionally map its value.
|
static AnnotationMetadata |
mutateMember(AnnotationMetadata annotationMetadata,
String annotationName,
Map<CharSequence,Object> members)
Sets a member of the given
AnnotationMetadata return a new annotation metadata instance without
mutating the existing. |
static AnnotationMetadata |
mutateMember(AnnotationMetadata annotationMetadata,
String annotationName,
String member,
Object value)
Sets a member of the given
AnnotationMetadata return a new annotation metadata instance without
mutating the existing. |
static void |
registerAnnotationDefaults(AnnotationClassValue<?> annotation,
Map<String,Object> defaultValues)
Registers annotation default values.
|
static void |
registerAnnotationDefaults(String annotation,
Map<String,Object> defaultValues)
Registers annotation default values.
|
static void |
registerAnnotationType(AnnotationClassValue<?> annotation)
Registers annotation default values.
|
static void |
registerRepeatableAnnotations(Map<String,String> repeatableAnnotations)
Registers repeatable annotations.
|
protected void |
removeAnnotation(String annotationType)
Removes an annotation for the given annotation type.
|
protected <A extends Annotation> |
removeAnnotationIf(Predicate<AnnotationValue<A>> predicate)
Removes an annotation for the given predicate.
|
protected void |
removeStereotype(String annotationType)
Removes a stereotype annotation for the given annotation type.
|
Optional<String> |
stringValue(Class<? extends Annotation> annotation,
String member)
The value as an optional string for the given annotation and member.
|
Optional<String> |
stringValue(Class<? extends Annotation> annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the string value and optionally map its value.
|
Optional<String> |
stringValue(String annotation,
String member)
The value as an optional string for the given annotation and member.
|
Optional<String> |
stringValue(String annotation,
String member,
Function<Object,Object> valueMapper)
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[] |
stringValues(String annotation,
String member,
Function<Object,Object> valueMapper)
Retrieve the string value and optionally map its value.
|
<T extends Annotation> |
synthesize(Class<T> annotationClass)
Synthesizes a new annotation from the metadata for the given annotation type.
|
<T extends Annotation> |
synthesize(Class<T> annotationClass,
String sourceAnnotation)
Synthesizes a new annotation for the given annotation type using the member values of the given source annotation.
|
Annotation[] |
synthesizeAll()
Synthesizes a new annotations from the metadata.
|
<T extends Annotation> |
synthesizeAnnotationsByType(Class<T> annotationClass)
Synthesizes a new annotations from the metadata for the given type.
|
Annotation[] |
synthesizeDeclared()
Synthesizes a new annotations from the metadata.
|
<T extends Annotation> |
synthesizeDeclared(Class<T> annotationClass)
Synthesizes a new annotation from the metadata for the given annotation type.
|
<T extends Annotation> |
synthesizeDeclared(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> |
synthesizeDeclaredAnnotationsByType(Class<T> annotationClass)
Synthesizes a new annotations from the metadata for the given type.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbooleanValue, booleanValue, classValue, classValue, classValues, classValues, doubleValue, findAnnotation, findDeclaredAnnotation, getAnnotationNameByStereotype, getAnnotationNamesByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDefaultValue, getDefaultValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, hasAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, intValue, isAnnotationPresent, isAnnotationPresent, isDeclaredAnnotationPresent, isDeclaredAnnotationPresent, isFalse, isPresent, stringValue, stringValue, stringValues, stringValuesgetAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, synthesize, synthesize, synthesizeAll, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredprotected final Map<String,Annotation> annotationMap
protected final Map<String,Annotation> declaredAnnotationMap
@Internal protected 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)
declaredAnnotations - The directly declared annotationsdeclaredStereotypes - The directly declared stereotypesallStereotypes - All of the stereotypesallAnnotations - All of the annotationsannotationsByStereotype - The annotations by stereotype@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)
declaredAnnotations - The directly declared annotationsdeclaredStereotypes - The directly declared stereotypesallStereotypes - All of the stereotypesallAnnotations - All of the annotationsannotationsByStereotype - The annotations by stereotypehasPropertyExpressions - Whether property expressions exist in the metadata@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 useRepeatableDefaults)
declaredAnnotations - The directly declared annotationsdeclaredStereotypes - The directly declared stereotypesallStereotypes - All of the stereotypesallAnnotations - All of the annotationsannotationsByStereotype - The annotations by stereotypehasPropertyExpressions - Whether property expressions exist in the metadatauseRepeatableDefaults - Use repeatable defaults@NonNull public AnnotationMetadata getDeclaredMetadata()
AnnotationMetadatagetDeclaredMetadata in interface AnnotationMetadatapublic boolean hasPropertyExpressions()
AnnotationMetadata${foo.bar}. Note
this by default returns true as 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.hasPropertyExpressions in interface AnnotationMetadata@NonNull public Map<String,Object> getDefaultValues(@NonNull String annotation)
AnnotationMetadatagetDefaultValues in interface AnnotationMetadataannotation - The annotation namepublic boolean isPresent(@NonNull String annotation, @NonNull String member)
AnnotationMetadataisPresent in interface AnnotationMetadataannotation - The annotation classmember - The annotation memberpublic <E extends Enum> Optional<E> enumValue(@NonNull String annotation, Class<E> enumType)
AnnotationMetadataenumValue in interface AnnotationMetadataE - The enum typeannotation - The annotationenumType - The enum typeOptional enum valuepublic <E extends Enum> Optional<E> enumValue(@NonNull String annotation, @NonNull String member, Class<E> enumType)
AnnotationMetadataenumValue in interface AnnotationMetadataE - The enum typeannotation - The annotationmember - The annotation memberenumType - The enum typeOptional classpublic <E extends Enum> Optional<E> enumValue(@NonNull Class<? extends Annotation> annotation, Class<E> enumType)
AnnotationMetadataenumValue in interface AnnotationMetadataE - The enum typeannotation - The annotationenumType - The enum typeOptional classpublic <E extends Enum> Optional<E> enumValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType)
AnnotationMetadataenumValue in interface AnnotationMetadataE - The enum typeannotation - The annotationmember - The annotation memberenumType - The enum typeOptional class@Internal public <E extends Enum> Optional<E> enumValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object,Object> valueMapper)
E - The enum typeannotation - The annotationmember - The memberenumType - The enum typevalueMapper - The value mapperpublic <E extends Enum> E[] enumValues(@NonNull String annotation, Class<E> enumType)
AnnotationMetadataenumValues in interface AnnotationMetadataE - The enum typeannotation - The annotationenumType - The enum typepublic <E extends Enum> E[] enumValues(@NonNull String annotation, @NonNull String member, Class<E> enumType)
AnnotationMetadataenumValues in interface AnnotationMetadataE - The enum typeannotation - The annotationmember - The annotation memberenumType - The enum typepublic <E extends Enum> E[] enumValues(@NonNull Class<? extends Annotation> annotation, Class<E> enumType)
AnnotationMetadataenumValues in interface AnnotationMetadataE - The enum typeannotation - The annotationenumType - The enum typepublic <E extends Enum> E[] enumValues(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType)
AnnotationMetadataenumValues in interface AnnotationMetadataE - The enum typeannotation - The annotationmember - The annotation memberenumType - The enum typepublic <E extends Enum> E[] enumValues(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object,Object> valueMapper)
E - The enum typeannotation - The annotationmember - The memberenumType - The enum typevalueMapper - The value mapperpublic <E extends Enum> E[] enumValues(@NonNull String annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object,Object> valueMapper)
E - The enum typeannotation - The annotationmember - The memberenumType - The enum typevalueMapper - The value mapper@Internal public <E extends Enum> Optional<E> enumValue(@NonNull String annotation, @NonNull String member, Class<E> enumType, @Nullable Function<Object,Object> valueMapper)
E - The enum typeannotation - The annotationmember - The memberenumType - The enum typevalueMapper - The value mapperpublic <T> Class<T>[] classValues(@NonNull String annotation, @NonNull String member)
AnnotationMetadataclassValues in interface AnnotationMetadataT - The type of the classannotation - The annotationmember - The annotation memberOptional classpublic <T> Class<T>[] classValues(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadataclassValues in interface AnnotationMetadataT - The type of the classannotation - The annotationmember - The annotation memberOptional class@NonNull public Optional<Class> classValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadataclassValue in interface AnnotationMetadataannotation - The annotationmember - The annotation memberOptional classpublic Optional<Class> classValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public Optional<Class> classValue(@NonNull String annotation, @NonNull String member)
AnnotationMetadataclassValue in interface AnnotationMetadataannotation - The annotationmember - The annotation memberOptional class@Internal public Optional<Class> classValue(@NonNull String annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public OptionalInt intValue(@NonNull String annotation, @NonNull String member)
AnnotationMetadataOptionalInt for the given annotation and member.intValue in interface AnnotationMetadataannotation - The annotationmember - The memberOptionalInt value@NonNull public OptionalInt intValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadataOptionalInt for the given annotation and member.intValue in interface AnnotationMetadataannotation - The annotationmember - The memberOptionalInt value@Internal public OptionalInt intValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapperpublic Optional<Boolean> booleanValue(@NonNull String annotation, @NonNull String member)
AnnotationMetadatabooleanValue in interface AnnotationMetadataannotation - The annotationmember - The memberpublic Optional<Boolean> booleanValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadatabooleanValue in interface AnnotationMetadataannotation - The annotationmember - The memberpublic Optional<Boolean> booleanValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public Optional<Boolean> booleanValue(@NonNull String annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public OptionalLong longValue(@NonNull String annotation, @NonNull String member)
AnnotationMetadataOptionalLong for the given annotation and member.longValue in interface AnnotationMetadataannotation - The annotationmember - The memberOptionalLong value@NonNull public OptionalLong longValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadataOptionalLong for the given annotation and member.longValue in interface AnnotationMetadataannotation - The annotationmember - The memberOptionalLong value@Internal public OptionalLong longValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public OptionalLong longValue(@NonNull String annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public OptionalInt intValue(@NonNull String annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public Optional<String> stringValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadatastringValue in interface AnnotationMetadataannotation - The annotationmember - The memberpublic Optional<String> stringValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public String[] stringValues(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadatastringValues in interface AnnotationMetadataannotation - The annotationmember - The member@NonNull public String[] stringValues(@NonNull String annotation, @NonNull String member)
AnnotationMetadatastringValues in interface AnnotationMetadataannotation - The annotationmember - The member@NonNull public String[] stringValues(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public String[] stringValues(@NonNull String annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public Optional<String> stringValue(@NonNull String annotation, @NonNull String member)
AnnotationMetadatastringValue in interface AnnotationMetadataannotation - The annotationmember - The member@NonNull public Optional<String> stringValue(@NonNull String annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapperpublic boolean isTrue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadataisTrue in interface AnnotationMetadataannotation - The annotation classmember - The annotation memberpublic boolean isTrue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapperpublic boolean isTrue(@NonNull String annotation, @NonNull String member)
AnnotationMetadataisTrue in interface AnnotationMetadataannotation - The annotation classmember - The annotation memberpublic boolean isTrue(@NonNull String annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapperpublic boolean isFalse(@NonNull String annotation, @NonNull String member)
AnnotationMetadataisFalse in interface AnnotationMetadataannotation - The annotation classmember - The annotation member@NonNull public OptionalDouble doubleValue(@NonNull String annotation, @NonNull String member)
AnnotationMetadataOptionalDouble for the given annotation and member.doubleValue in interface AnnotationMetadataannotation - The annotationmember - The memberOptionalDouble value@NonNull public OptionalDouble doubleValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member)
AnnotationMetadataOptionalDouble for the given annotation and member.doubleValue in interface AnnotationMetadataannotation - The annotationmember - The memberOptionalDouble value@Internal public OptionalDouble doubleValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @Nullable Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull @Internal public OptionalDouble doubleValue(@NonNull String annotation, @NonNull String member, Function<Object,Object> valueMapper)
annotation - The annotationmember - The membervalueMapper - The value mapper@NonNull public <T> Optional<T> getValue(@NonNull Class<? extends Annotation> annotation, @NonNull String member, @NonNull Class<T> requiredType)
AnnotationMetadatagetValue in interface AnnotationMetadataT - The valueannotation - The annotation classmember - The annotation memberrequiredType - The required typeOptional of the value@NonNull public <T> Optional<T> getValue(@NonNull String annotation, @NonNull String member, @NonNull Argument<T> requiredType)
AnnotationMetadatagetValue in interface AnnotationMetadataT - The valueannotation - The annotation classmember - The annotation memberrequiredType - The required typeOptional of the value@NonNull public <T> Optional<T> getValue(@NonNull String annotation, @NonNull String member, @NonNull Argument<T> requiredType, @Nullable Function<Object,Object> valueMapper)
T - The generic typeannotation - The annotationmember - The memberrequiredType - The required typevalueMapper - The value mapper@NonNull public <T> Optional<T> getDefaultValue(@NonNull String annotation, @NonNull String member, @NonNull Class<T> requiredType)
AnnotationMetadatagetDefaultValue in interface AnnotationMetadataT - The required generic typeannotation - The annotationmember - The memberrequiredType - The required type@NonNull public <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByType(@Nullable Class<T> annotationType)
AnnotationMetadatagetAnnotationValuesByType in interface AnnotationMetadataT - The annotation typeannotationType - The annotation typepublic <T extends Annotation> List<AnnotationValue<T>> getAnnotationValuesByName(String annotationType)
AnnotationMetadatagetAnnotationValuesByName in interface AnnotationMetadataT - The annotation typeannotationType - The annotation type@NonNull public <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByType(@NonNull Class<T> annotationType)
AnnotationMetadatagetDeclaredAnnotationValuesByType in interface AnnotationMetadataT - The annotation typeannotationType - The annotation typepublic <T extends Annotation> List<AnnotationValue<T>> getDeclaredAnnotationValuesByName(String annotationType)
AnnotationMetadatagetDeclaredAnnotationValuesByName in interface AnnotationMetadataT - The annotation typeannotationType - The annotation typepublic <T extends Annotation> T[] synthesizeAnnotationsByType(@NonNull Class<T> annotationClass)
AnnotationSourcesynthesizeAnnotationsByType in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation typepublic <T extends Annotation> T[] synthesizeDeclaredAnnotationsByType(@NonNull Class<T> annotationClass)
AnnotationSourcesynthesizeDeclaredAnnotationsByType in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation typepublic boolean isEmpty()
AnnotationMetadataisEmpty in interface AnnotationMetadatapublic boolean hasDeclaredAnnotation(String annotation)
AnnotationMetadatahasDeclaredAnnotation in interface AnnotationMetadataannotation - The annotationpublic boolean hasAnnotation(String annotation)
AnnotationMetadatahasAnnotation in interface AnnotationMetadataannotation - The annotationpublic boolean hasStereotype(String annotation)
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
hasStereotype in interface AnnotationMetadataannotation - The annotationpublic boolean hasDeclaredStereotype(String annotation)
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
hasDeclaredStereotype in interface AnnotationMetadataannotation - The annotation@NonNull public Optional<Class<? extends Annotation>> getAnnotationTypeByStereotype(@Nullable String stereotype)
AnnotationMetadatagetAnnotationTypeByStereotype in interface AnnotationMetadatastereotype - The stereotype@NonNull public Optional<String> getAnnotationNameByStereotype(@Nullable String stereotype)
AnnotationMetadatagetAnnotationNameByStereotype in interface AnnotationMetadatastereotype - The stereotype@NonNull public List<String> getAnnotationNamesByStereotype(@Nullable String stereotype)
AnnotationMetadatagetAnnotationNamesByStereotype in interface AnnotationMetadatastereotype - The annotation names@NonNull public Set<String> getAnnotationNames()
AnnotationMetadatagetAnnotationNames in interface AnnotationMetadatapublic Set<String> getStereotypeAnnotationNames()
AnnotationMetadataA stereotype is a meta-annotation (an annotation declared on another annotation).
getStereotypeAnnotationNames in interface AnnotationMetadataAnnotationMetadata.getDeclaredStereotypeAnnotationNames()public Set<String> getDeclaredStereotypeAnnotationNames()
AnnotationMetadataA 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.
getDeclaredStereotypeAnnotationNames in interface AnnotationMetadataAnnotationMetadata.getStereotypeAnnotationNames(),
AnnotationMetadata.getDeclaredAnnotationNames()@NonNull public Set<String> getDeclaredAnnotationNames()
AnnotationMetadatagetDeclaredAnnotationNames in interface AnnotationMetadata@NonNull public List<String> getDeclaredAnnotationNamesByStereotype(@Nullable String stereotype)
AnnotationMetadatagetDeclaredAnnotationNamesByStereotype in interface AnnotationMetadatastereotype - The stereotype@NonNull public Optional<Class<? extends Annotation>> getAnnotationType(@NonNull String name)
AnnotationMetadatagetAnnotationType in interface AnnotationMetadataname - The type name@NonNull public Optional<Class<? extends Annotation>> getAnnotationType(@NonNull String name, @NonNull ClassLoader classLoader)
AnnotationMetadatagetAnnotationType in interface AnnotationMetadataname - The type nameclassLoader - The ClassLoader to load the type@NonNull public <T extends Annotation> Optional<AnnotationValue<T>> findAnnotation(@NonNull String annotation)
AnnotationSourceAnnotationValue for the given annotation name.findAnnotation in interface AnnotationSourceT - The annotation typeannotation - The annotation nameAnnotationValue instance@NonNull public <T extends Annotation> Optional<AnnotationValue<T>> findDeclaredAnnotation(@NonNull String annotation)
AnnotationSourcefindDeclaredAnnotation in interface AnnotationSourceT - The annotation typeannotation - The annotation nameAnnotationValue instance@NonNull public <T> OptionalValues<T> getValues(@NonNull String annotation, @NonNull Class<T> valueType)
AnnotationMetadatagetValues in interface AnnotationMetadataT - Generic typeannotation - The annotation namevalueType - valueTypeOptionalValues@NonNull public Map<CharSequence,Object> getValues(@NonNull String annotation)
AnnotationMetadatagetValues in interface AnnotationMetadataannotation - The annotation name@NonNull public <T> Optional<T> getDefaultValue(@NonNull String annotation, @NonNull String member, @NonNull Argument<T> requiredType)
AnnotationMetadatagetDefaultValue in interface AnnotationMetadataT - The required generic typeannotation - The annotationmember - The memberrequiredType - The required typepublic boolean isRepeatableAnnotation(Class<? extends Annotation> annotation)
AnnotationMetadataisRepeatableAnnotation in interface AnnotationMetadataannotation - The annotationpublic boolean isRepeatableAnnotation(String annotation)
AnnotationMetadataisRepeatableAnnotation in interface AnnotationMetadataannotation - The annotationpublic Optional<String> findRepeatableAnnotation(Class<? extends Annotation> annotation)
AnnotationMetadatafindRepeatableAnnotation in interface AnnotationMetadataannotation - The annotationpublic Optional<String> findRepeatableAnnotation(String annotation)
AnnotationMetadatafindRepeatableAnnotation in interface AnnotationMetadataannotation - The annotationpublic DefaultAnnotationMetadata clone()
protected void addAnnotation(String annotation, Map<CharSequence,Object> values)
annotation - The annotationvalues - The valuesprotected void addAnnotation(String annotation, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
annotation - The annotationvalues - The valuesretentionPolicy - The retention policyprotected final void addDefaultAnnotationValues(String annotation, Map<CharSequence,Object> values)
annotation - The annotationvalues - The values@Internal public static boolean areAnnotationDefaultsRegistered(String annotation)
annotation - The annotation name@Internal public static void registerAnnotationDefaults(String annotation, Map<String,Object> defaultValues)
annotation - The annotation namedefaultValues - The default values@Internal public static void registerAnnotationDefaults(AnnotationClassValue<?> annotation, Map<String,Object> defaultValues)
annotation - The annotation namedefaultValues - The default values@Internal public static void registerAnnotationType(AnnotationClassValue<?> annotation)
annotation - The annotation@Internal public static void registerRepeatableAnnotations(Map<String,String> repeatableAnnotations)
repeatableAnnotations - The annotationprotected void addRepeatable(String annotationName, AnnotationValue annotationValue)
annotationName - The annotation nameannotationValue - The annotation valueprotected void addRepeatable(String annotationName, AnnotationValue annotationValue, RetentionPolicy retentionPolicy)
annotationName - The annotation nameannotationValue - The annotation valueretentionPolicy - The retention policyprotected void addRepeatableStereotype(List<String> parents, String stereotype, AnnotationValue annotationValue)
parents - The parent annotationsstereotype - The annotation nameannotationValue - The annotation valueprotected void addDeclaredRepeatableStereotype(List<String> parents, String stereotype, AnnotationValue annotationValue)
parents - The parent annotationsstereotype - The annotation nameannotationValue - The annotation valueprotected void addDeclaredRepeatable(String annotationName, AnnotationValue annotationValue)
annotationName - The annotation nameannotationValue - The annotation valueprotected void addDeclaredRepeatable(String annotationName, AnnotationValue annotationValue, RetentionPolicy retentionPolicy)
annotationName - The annotation nameannotationValue - The annotation valueretentionPolicy - The retention policyprotected final void addStereotype(List<String> parentAnnotations, String stereotype, Map<CharSequence,Object> values)
parentAnnotations - The parent annotationsstereotype - The annotationvalues - The valuesprotected final void addStereotype(List<String> parentAnnotations, String stereotype, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
parentAnnotations - The parent annotationsstereotype - The annotationvalues - The valuesretentionPolicy - The retention policyprotected void addDeclaredStereotype(List<String> parentAnnotations, String stereotype, Map<CharSequence,Object> values)
parentAnnotations - The parent annotationsstereotype - The annotationvalues - The valuesprotected void addDeclaredStereotype(List<String> parentAnnotations, String stereotype, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
parentAnnotations - The parent annotationsstereotype - The annotationvalues - The valuesretentionPolicy - The retention policyprotected void addDeclaredAnnotation(String annotation, Map<CharSequence,Object> values)
annotation - The annotationvalues - The valuesprotected void addDeclaredAnnotation(String annotation, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
annotation - The annotationvalues - The valuesretentionPolicy - The retention policy@Internal public static AnnotationMetadata mutateMember(AnnotationMetadata annotationMetadata, String annotationName, String member, Object value)
Sets a member of the given AnnotationMetadata return a new annotation metadata instance without
mutating the existing.
WARNING: for internal use only be the framework
annotationMetadata - The metadataannotationName - The annotation namemember - The membervalue - The value@Internal public static void contributeDefaults(AnnotationMetadata target, AnnotationMetadata source)
WARNING: for internal use only be the framework
target - The targetsource - The source@Internal public static void contributeRepeatable(AnnotationMetadata target, AnnotationMetadata source)
WARNING: for internal use only be the framework
target - The targetsource - The source@Internal public static void contributeRepeatable(AnnotationMetadata target, ClassElement classElement)
WARNING: for internal use only be the framework
target - The targetclassElement - The source@Internal public static AnnotationMetadata mutateMember(AnnotationMetadata annotationMetadata, String annotationName, Map<CharSequence,Object> members)
Sets a member of the given AnnotationMetadata return a new annotation metadata instance without
mutating the existing.
WARNING: for internal use only be the framework
annotationMetadata - The metadataannotationName - The annotation namemembers - The key/value set of members and valuesprotected <A extends Annotation> void removeAnnotationIf(@NonNull Predicate<AnnotationValue<A>> predicate)
A - The annotationpredicate - The predicateprotected void removeAnnotation(String annotationType)
annotationType - The annotation typeprotected void removeStereotype(String annotationType)
annotationType - The annotation type@Nullable public <T extends Annotation> T synthesize(@NonNull Class<T> annotationClass)
AnnotationSourcesynthesize in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation class@Nullable public <T extends Annotation> T synthesize(@NonNull Class<T> annotationClass, @NonNull String sourceAnnotation)
AnnotationSourceThis method allows supporting synthesizing annotations that have been renamed, for example a jakarta.inject.Named annotation an be synthesized from the metadata of the a javax.inject.Named annotation.
synthesize in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation classsourceAnnotation - The source annotation that provides the member values@Nullable public <T extends Annotation> T synthesizeDeclared(@NonNull Class<T> annotationClass, @NonNull String sourceAnnotation)
AnnotationSourceThis method allows supporting synthesizing annotations that have been renamed, for example a jakarta.inject.Named annotation an be synthesized from the metadata of the a javax.inject.Named annotation.
synthesizeDeclared in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation classsourceAnnotation - The source annotation that provides the member values@Nullable public <T extends Annotation> T synthesizeDeclared(@NonNull Class<T> annotationClass)
AnnotationSourceThis method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)
synthesizeDeclared in interface AnnotationSourceT - The annotation generic typeannotationClass - The annotation class@NonNull public Annotation[] synthesizeAll()
AnnotationSourcesynthesizeAll in interface AnnotationSource@NonNull public Annotation[] synthesizeDeclared()
AnnotationSourcesynthesizeDeclared in interface AnnotationSourceprotected final void addAnnotationValuesFromData(List results, Map<CharSequence,Object> values)
results - The resultsvalues - The valuesprotected void addValuesToResults(List<AnnotationValue> results, AnnotationValue values)
results - The resultsvalues - The values