public class MutableAnnotationMetadata extends DefaultAnnotationMetadata
DefaultAnnotationMetadata that is used only at build time.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Annotation> |
annotationMap |
protected Map<String,Annotation> |
declaredAnnotationMap |
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Constructor and Description |
|---|
MutableAnnotationMetadata()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
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.
|
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.
|
void |
addDeclaredRepeatable(String annotationName,
AnnotationValue annotationValue)
Adds a repeatable annotation value.
|
void |
addDeclaredRepeatable(String annotationName,
AnnotationValue annotationValue,
RetentionPolicy retentionPolicy)
Adds a repeatable annotation value.
|
void |
addDeclaredRepeatableStereotype(List<String> parents,
String stereotype,
AnnotationValue annotationValue)
Adds a repeatable declared stereotype value.
|
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.
|
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.
|
void |
addRepeatable(String annotationName,
AnnotationValue annotationValue)
Adds a repeatable annotation value.
|
void |
addRepeatable(String annotationName,
AnnotationValue annotationValue,
RetentionPolicy retentionPolicy)
Adds a repeatable annotation value.
|
void |
addRepeatableStereotype(List<String> parents,
String stereotype,
AnnotationValue annotationValue)
Adds a repeatable stereotype value.
|
protected void |
addValuesToResults(List<AnnotationValue> results,
AnnotationValue values)
Adds a values instance to the results.
|
MutableAnnotationMetadata |
clone() |
@NotNull Map<String,Object> |
getDefaultValues(String annotation)
Return the default values for the given annotation name.
|
boolean |
hasPropertyExpressions()
Does the metadata contain any property expressions like
${foo.bar}. |
void |
removeAnnotation(String annotationType)
Removes an annotation for the given annotation type.
|
<A extends Annotation> |
removeAnnotationIf(Predicate<AnnotationValue<A>> predicate)
Removes an annotation for the given predicate.
|
void |
removeStereotype(String annotationType)
Removes a stereotype annotation for the given annotation type.
|
<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.
|
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.
|
addDefaultAnnotationValues, addStereotype, addStereotype, areAnnotationDefaultsRegistered, booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, contributeDefaults, contributeRepeatable, contributeRepeatable, doubleValue, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, enumValues, enumValues, findAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationValuesByName, getAnnotationValuesByType, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getStereotypeAnnotationNames, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasStereotype, intValue, intValue, intValue, intValue, isEmpty, isFalse, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, isTrue, isTrue, longValue, longValue, longValue, longValue, mutateMember, mutateMember, registerAnnotationDefaults, registerAnnotationDefaults, registerAnnotationType, registerRepeatableAnnotations, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesizeAnnotationsByType, synthesizeDeclaredAnnotationsByTypeequals, 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
public MutableAnnotationMetadata()
public 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 AnnotationMetadatahasPropertyExpressions in class DefaultAnnotationMetadatapublic MutableAnnotationMetadata clone()
clone in class DefaultAnnotationMetadata@NotNull public @NotNull Map<String,Object> getDefaultValues(@NonNull String annotation)
AnnotationMetadatagetDefaultValues in interface AnnotationMetadatagetDefaultValues in class DefaultAnnotationMetadataannotation - The annotation namepublic <A extends Annotation> void removeAnnotationIf(@NonNull Predicate<AnnotationValue<A>> predicate)
DefaultAnnotationMetadataremoveAnnotationIf in class DefaultAnnotationMetadataA - The annotationpredicate - The predicatepublic void removeAnnotation(String annotationType)
DefaultAnnotationMetadataremoveAnnotation in class DefaultAnnotationMetadataannotationType - The annotation typepublic void removeStereotype(String annotationType)
DefaultAnnotationMetadataremoveStereotype in class DefaultAnnotationMetadataannotationType - The annotation typepublic void addAnnotation(String annotation, Map<CharSequence,Object> values)
DefaultAnnotationMetadataaddAnnotation in class DefaultAnnotationMetadataannotation - The annotationvalues - The valuespublic void addAnnotation(String annotation, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
DefaultAnnotationMetadataaddAnnotation in class DefaultAnnotationMetadataannotation - The annotationvalues - The valuesretentionPolicy - The retention policypublic void addRepeatableStereotype(List<String> parents, String stereotype, AnnotationValue annotationValue)
DefaultAnnotationMetadataaddRepeatableStereotype in class DefaultAnnotationMetadataparents - The parent annotationsstereotype - The annotation nameannotationValue - The annotation valuepublic void addDeclaredRepeatableStereotype(List<String> parents, String stereotype, AnnotationValue annotationValue)
DefaultAnnotationMetadataaddDeclaredRepeatableStereotype in class DefaultAnnotationMetadataparents - The parent annotationsstereotype - The annotation nameannotationValue - The annotation valuepublic void addDeclaredAnnotation(String annotation, Map<CharSequence,Object> values)
DefaultAnnotationMetadataaddDeclaredAnnotation in class DefaultAnnotationMetadataannotation - The annotationvalues - The valuespublic void addDeclaredAnnotation(String annotation, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
DefaultAnnotationMetadataaddDeclaredAnnotation in class DefaultAnnotationMetadataannotation - The annotationvalues - The valuesretentionPolicy - The retention policypublic void addRepeatable(String annotationName, AnnotationValue annotationValue)
DefaultAnnotationMetadataaddRepeatable in class DefaultAnnotationMetadataannotationName - The annotation nameannotationValue - The annotation valuepublic void addRepeatable(String annotationName, AnnotationValue annotationValue, RetentionPolicy retentionPolicy)
DefaultAnnotationMetadataaddRepeatable in class DefaultAnnotationMetadataannotationName - The annotation nameannotationValue - The annotation valueretentionPolicy - The retention policypublic void addDeclaredRepeatable(String annotationName, AnnotationValue annotationValue)
DefaultAnnotationMetadataaddDeclaredRepeatable in class DefaultAnnotationMetadataannotationName - The annotation nameannotationValue - The annotation valuepublic void addDeclaredRepeatable(String annotationName, AnnotationValue annotationValue, RetentionPolicy retentionPolicy)
DefaultAnnotationMetadataaddDeclaredRepeatable in class DefaultAnnotationMetadataannotationName - The annotation nameannotationValue - The annotation valueretentionPolicy - The retention policypublic void addDeclaredStereotype(List<String> parentAnnotations, String stereotype, Map<CharSequence,Object> values)
DefaultAnnotationMetadataaddDeclaredStereotype in class DefaultAnnotationMetadataparentAnnotations - The parent annotationsstereotype - The annotationvalues - The valuespublic void addDeclaredStereotype(List<String> parentAnnotations, String stereotype, Map<CharSequence,Object> values, RetentionPolicy retentionPolicy)
DefaultAnnotationMetadataaddDeclaredStereotype in class DefaultAnnotationMetadataparentAnnotations - The parent annotationsstereotype - The annotationvalues - The valuesretentionPolicy - The retention policy@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