Package io.micronaut.inject.annotation
Class MutableAnnotationMetadata
- java.lang.Object
-
- io.micronaut.inject.annotation.DefaultAnnotationMetadata
-
- io.micronaut.inject.annotation.MutableAnnotationMetadata
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadata,io.micronaut.core.annotation.AnnotationSource,java.lang.Cloneable
public class MutableAnnotationMetadata extends DefaultAnnotationMetadata
A mutable various ofDefaultAnnotationMetadatathat is used only at build time.- Since:
- 2.4.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.annotation.Annotation>annotationMapprotected java.util.Map<java.lang.String,java.lang.annotation.Annotation>declaredAnnotationMap
-
Constructor Summary
Constructors Constructor Description MutableAnnotationMetadata()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Adds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.voidaddAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy)Adds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.protected voidaddAnnotationValuesFromData(java.util.List results, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Adds any annotation values found in the values map to the results.voidaddDeclaredAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.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.voidaddDeclaredAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values, java.lang.annotation.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.voidaddDeclaredRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue)Adds a repeatable annotation value.voidaddDeclaredRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue, java.lang.annotation.RetentionPolicy retentionPolicy)Adds a repeatable annotation value.voidaddDeclaredRepeatableStereotype(java.util.List<java.lang.String> parents, java.lang.String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue)Adds a repeatable declared stereotype value.voidaddDeclaredStereotype(java.util.List<java.lang.String> parentAnnotations, java.lang.String stereotype, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.voidaddDeclaredStereotype(java.util.List<java.lang.String> parentAnnotations, java.lang.String stereotype, java.util.Map<java.lang.CharSequence,java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy)Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.voidaddRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue)Adds a repeatable annotation value.voidaddRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue, java.lang.annotation.RetentionPolicy retentionPolicy)Adds a repeatable annotation value.voidaddRepeatableStereotype(java.util.List<java.lang.String> parents, java.lang.String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue)Adds a repeatable stereotype value.protected voidaddValuesToResults(java.util.List<io.micronaut.core.annotation.AnnotationValue> results, io.micronaut.core.annotation.AnnotationValue values)Adds a values instance to the results.MutableAnnotationMetadataclone()java.util.Map<java.lang.String,java.lang.Object>getDefaultValues(java.lang.String annotation)booleanhasPropertyExpressions()voidremoveAnnotation(java.lang.String annotationType)Removes an annotation for the given annotation type.<A extends java.lang.annotation.Annotation>
voidremoveAnnotationIf(java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<A>> predicate)Removes an annotation for the given predicate.voidremoveStereotype(java.lang.String annotationType)Removes a stereotype annotation for the given annotation type.<T extends java.lang.annotation.Annotation>
Tsynthesize(java.lang.Class<T> annotationClass)<T extends java.lang.annotation.Annotation>
Tsynthesize(java.lang.Class<T> annotationClass, java.lang.String sourceAnnotation)java.lang.annotation.Annotation[]synthesizeAll()java.lang.annotation.Annotation[]synthesizeDeclared()<T extends java.lang.annotation.Annotation>
TsynthesizeDeclared(java.lang.Class<T> annotationClass)<T extends java.lang.annotation.Annotation>
TsynthesizeDeclared(java.lang.Class<T> annotationClass, java.lang.String sourceAnnotation)-
Methods inherited from class io.micronaut.inject.annotation.DefaultAnnotationMetadata
addDefaultAnnotationValues, addStereotype, addStereotype, areAnnotationDefaultsRegistered, booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, cloneMap, cloneMapOfListValue, cloneMapOfMapValue, 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, getAnnotationValuesByStereotype, 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, synthesizeDeclaredAnnotationsByType
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
booleanValue, 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, stringValues
-
-
-
-
Method Detail
-
hasPropertyExpressions
public boolean hasPropertyExpressions()
- Specified by:
hasPropertyExpressionsin interfaceio.micronaut.core.annotation.AnnotationMetadata- Overrides:
hasPropertyExpressionsin classDefaultAnnotationMetadata
-
clone
public MutableAnnotationMetadata clone()
- Overrides:
clonein classDefaultAnnotationMetadata
-
getDefaultValues
@NonNull public java.util.Map<java.lang.String,java.lang.Object> getDefaultValues(@NonNull java.lang.String annotation)- Specified by:
getDefaultValuesin interfaceio.micronaut.core.annotation.AnnotationMetadata- Overrides:
getDefaultValuesin classDefaultAnnotationMetadata
-
removeAnnotationIf
public <A extends java.lang.annotation.Annotation> void removeAnnotationIf(@NonNull java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<A>> predicate)Description copied from class:DefaultAnnotationMetadataRemoves an annotation for the given predicate.- Overrides:
removeAnnotationIfin classDefaultAnnotationMetadata- Type Parameters:
A- The annotation- Parameters:
predicate- The predicate
-
removeAnnotation
public void removeAnnotation(java.lang.String annotationType)
Description copied from class:DefaultAnnotationMetadataRemoves an annotation for the given annotation type.- Overrides:
removeAnnotationin classDefaultAnnotationMetadata- Parameters:
annotationType- The annotation type
-
removeStereotype
public void removeStereotype(java.lang.String annotationType)
Description copied from class:DefaultAnnotationMetadataRemoves a stereotype annotation for the given annotation type.- Overrides:
removeStereotypein classDefaultAnnotationMetadata- Parameters:
annotationType- The annotation type
-
addAnnotation
public void addAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Description copied from class:DefaultAnnotationMetadataAdds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addAnnotationin classDefaultAnnotationMetadata- Parameters:
annotation- The annotationvalues- The values
-
addAnnotation
public void addAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy)Description copied from class:DefaultAnnotationMetadataAdds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addAnnotationin classDefaultAnnotationMetadata- Parameters:
annotation- The annotationvalues- The valuesretentionPolicy- The retention policy
-
addRepeatableStereotype
public void addRepeatableStereotype(java.util.List<java.lang.String> parents, java.lang.String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue)Description copied from class:DefaultAnnotationMetadataAdds a repeatable stereotype value. If a value already exists will be added- Overrides:
addRepeatableStereotypein classDefaultAnnotationMetadata- Parameters:
parents- The parent annotationsstereotype- The annotation nameannotationValue- The annotation value
-
addDeclaredRepeatableStereotype
public void addDeclaredRepeatableStereotype(java.util.List<java.lang.String> parents, java.lang.String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue)Description copied from class:DefaultAnnotationMetadataAdds a repeatable declared stereotype value. If a value already exists will be added- Overrides:
addDeclaredRepeatableStereotypein classDefaultAnnotationMetadata- Parameters:
parents- The parent annotationsstereotype- The annotation nameannotationValue- The annotation value
-
addDeclaredAnnotation
public void addDeclaredAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Description copied from class:DefaultAnnotationMetadataAdds 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.- Overrides:
addDeclaredAnnotationin classDefaultAnnotationMetadata- Parameters:
annotation- The annotationvalues- The values
-
addDeclaredAnnotation
public void addDeclaredAnnotation(java.lang.String annotation, java.util.Map<java.lang.CharSequence,java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy)Description copied from class:DefaultAnnotationMetadataAdds 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.- Overrides:
addDeclaredAnnotationin classDefaultAnnotationMetadata- Parameters:
annotation- The annotationvalues- The valuesretentionPolicy- The retention policy
-
addRepeatable
public void addRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue)Description copied from class:DefaultAnnotationMetadataAdds a repeatable annotation value. If a value already exists will be added- Overrides:
addRepeatablein classDefaultAnnotationMetadata- Parameters:
annotationName- The annotation nameannotationValue- The annotation value
-
addRepeatable
public void addRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue, java.lang.annotation.RetentionPolicy retentionPolicy)Description copied from class:DefaultAnnotationMetadataAdds a repeatable annotation value. If a value already exists will be added- Overrides:
addRepeatablein classDefaultAnnotationMetadata- Parameters:
annotationName- The annotation nameannotationValue- The annotation valueretentionPolicy- The retention policy
-
addDeclaredRepeatable
public void addDeclaredRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue)Description copied from class:DefaultAnnotationMetadataAdds a repeatable annotation value. If a value already exists will be added- Overrides:
addDeclaredRepeatablein classDefaultAnnotationMetadata- Parameters:
annotationName- The annotation nameannotationValue- The annotation value
-
addDeclaredRepeatable
public void addDeclaredRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue, java.lang.annotation.RetentionPolicy retentionPolicy)Description copied from class:DefaultAnnotationMetadataAdds a repeatable annotation value. If a value already exists will be added- Overrides:
addDeclaredRepeatablein classDefaultAnnotationMetadata- Parameters:
annotationName- The annotation nameannotationValue- The annotation valueretentionPolicy- The retention policy
-
addDeclaredStereotype
public void addDeclaredStereotype(java.util.List<java.lang.String> parentAnnotations, java.lang.String stereotype, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Description copied from class:DefaultAnnotationMetadataAdds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addDeclaredStereotypein classDefaultAnnotationMetadata- Parameters:
parentAnnotations- The parent annotationsstereotype- The annotationvalues- The values
-
addDeclaredStereotype
public void addDeclaredStereotype(java.util.List<java.lang.String> parentAnnotations, java.lang.String stereotype, java.util.Map<java.lang.CharSequence,java.lang.Object> values, java.lang.annotation.RetentionPolicy retentionPolicy)Description copied from class:DefaultAnnotationMetadataAdds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addDeclaredStereotypein classDefaultAnnotationMetadata- Parameters:
parentAnnotations- The parent annotationsstereotype- The annotationvalues- The valuesretentionPolicy- The retention policy
-
synthesize
@Nullable public <T extends java.lang.annotation.Annotation> T synthesize(@NonNull java.lang.Class<T> annotationClass)- Specified by:
synthesizein interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesize
@Nullable public <T extends java.lang.annotation.Annotation> T synthesize(@NonNull java.lang.Class<T> annotationClass, @NonNull java.lang.String sourceAnnotation)- Specified by:
synthesizein interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@Nullable public <T extends java.lang.annotation.Annotation> T synthesizeDeclared(@NonNull java.lang.Class<T> annotationClass, @NonNull java.lang.String sourceAnnotation)- Specified by:
synthesizeDeclaredin interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@Nullable public <T extends java.lang.annotation.Annotation> T synthesizeDeclared(@NonNull java.lang.Class<T> annotationClass)- Specified by:
synthesizeDeclaredin interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeAll
@NonNull public java.lang.annotation.Annotation[] synthesizeAll()
- Specified by:
synthesizeAllin interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@NonNull public java.lang.annotation.Annotation[] synthesizeDeclared()
- Specified by:
synthesizeDeclaredin interfaceio.micronaut.core.annotation.AnnotationSource
-
addAnnotationValuesFromData
protected final void addAnnotationValuesFromData(java.util.List results, java.util.Map<java.lang.CharSequence,java.lang.Object> values)Adds any annotation values found in the values map to the results.- Parameters:
results- The resultsvalues- The values
-
addValuesToResults
protected void addValuesToResults(java.util.List<io.micronaut.core.annotation.AnnotationValue> results, io.micronaut.core.annotation.AnnotationValue values)Adds a values instance to the results.- Parameters:
results- The resultsvalues- The values
-
-