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 ofDefaultAnnotationMetadata
that 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>
annotationMap
protected 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 void
addAnnotation(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.void
addAnnotation(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 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.void
addDeclaredAnnotation(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.void
addDeclaredAnnotation(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.void
addDeclaredRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue)
Adds a repeatable annotation value.void
addDeclaredRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue, java.lang.annotation.RetentionPolicy retentionPolicy)
Adds a repeatable annotation value.void
addDeclaredRepeatableStereotype(java.util.List<java.lang.String> parents, java.lang.String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue)
Adds a repeatable declared stereotype value.void
addDeclaredStereotype(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.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)
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.void
addRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue)
Adds a repeatable annotation value.void
addRepeatable(java.lang.String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue, java.lang.annotation.RetentionPolicy retentionPolicy)
Adds a repeatable annotation value.void
addRepeatableStereotype(java.util.List<java.lang.String> parents, java.lang.String stereotype, io.micronaut.core.annotation.AnnotationValue annotationValue)
Adds a repeatable stereotype value.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.MutableAnnotationMetadata
clone()
java.util.Map<java.lang.String,java.lang.Object>
getDefaultValues(java.lang.String annotation)
boolean
hasPropertyExpressions()
void
removeAnnotation(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.void
removeStereotype(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:
hasPropertyExpressions
in interfaceio.micronaut.core.annotation.AnnotationMetadata
- Overrides:
hasPropertyExpressions
in classDefaultAnnotationMetadata
-
clone
public MutableAnnotationMetadata clone()
- Overrides:
clone
in classDefaultAnnotationMetadata
-
getDefaultValues
@NonNull public java.util.Map<java.lang.String,java.lang.Object> getDefaultValues(@NonNull java.lang.String annotation)
- Specified by:
getDefaultValues
in interfaceio.micronaut.core.annotation.AnnotationMetadata
- Overrides:
getDefaultValues
in 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:DefaultAnnotationMetadata
Removes an annotation for the given predicate.- Overrides:
removeAnnotationIf
in classDefaultAnnotationMetadata
- Type Parameters:
A
- The annotation- Parameters:
predicate
- The predicate
-
removeAnnotation
public void removeAnnotation(java.lang.String annotationType)
Description copied from class:DefaultAnnotationMetadata
Removes an annotation for the given annotation type.- Overrides:
removeAnnotation
in classDefaultAnnotationMetadata
- Parameters:
annotationType
- The annotation type
-
removeStereotype
public void removeStereotype(java.lang.String annotationType)
Description copied from class:DefaultAnnotationMetadata
Removes a stereotype annotation for the given annotation type.- Overrides:
removeStereotype
in 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:DefaultAnnotationMetadata
Adds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addAnnotation
in 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:DefaultAnnotationMetadata
Adds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addAnnotation
in 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:DefaultAnnotationMetadata
Adds a repeatable stereotype value. If a value already exists will be added- Overrides:
addRepeatableStereotype
in 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:DefaultAnnotationMetadata
Adds a repeatable declared stereotype value. If a value already exists will be added- Overrides:
addDeclaredRepeatableStereotype
in 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:DefaultAnnotationMetadata
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.- Overrides:
addDeclaredAnnotation
in 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:DefaultAnnotationMetadata
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.- Overrides:
addDeclaredAnnotation
in 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:DefaultAnnotationMetadata
Adds a repeatable annotation value. If a value already exists will be added- Overrides:
addRepeatable
in 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:DefaultAnnotationMetadata
Adds a repeatable annotation value. If a value already exists will be added- Overrides:
addRepeatable
in 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:DefaultAnnotationMetadata
Adds a repeatable annotation value. If a value already exists will be added- Overrides:
addDeclaredRepeatable
in 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:DefaultAnnotationMetadata
Adds a repeatable annotation value. If a value already exists will be added- Overrides:
addDeclaredRepeatable
in 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:DefaultAnnotationMetadata
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addDeclaredStereotype
in 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:DefaultAnnotationMetadata
Adds a stereotype and its member values, if the annotation already exists the data will be merged with existing values replaced.- Overrides:
addDeclaredStereotype
in 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:
synthesize
in 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:
synthesize
in 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:
synthesizeDeclared
in interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@Nullable public <T extends java.lang.annotation.Annotation> T synthesizeDeclared(@NonNull java.lang.Class<T> annotationClass)
- Specified by:
synthesizeDeclared
in interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeAll
@NonNull public java.lang.annotation.Annotation[] synthesizeAll()
- Specified by:
synthesizeAll
in interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@NonNull public java.lang.annotation.Annotation[] synthesizeDeclared()
- Specified by:
synthesizeDeclared
in 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
-
-