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,Cloneable
A mutable various of
DefaultAnnotationMetadata that is used only at build time.- Since:
- 2.4.0
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(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.voidaddAnnotation(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.voidaddAnnotationMetadata(DefaultAnnotationMetadata annotationMetadata) Include the annotation metadata from the other instance ofDefaultAnnotationMetadata.voidaddAnnotationMetadata(MutableAnnotationMetadata annotationMetadata) Include the annotation metadata from the other instance ofDefaultAnnotationMetadata.voidaddDeclaredAnnotation(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.voidaddDeclaredAnnotation(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.voidaddDeclaredRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable annotation value.voidaddDeclaredRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue, RetentionPolicy retentionPolicy) Adds a repeatable annotation value.voidaddDeclaredRepeatableStereotype(List<String> parents, String stereotype, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable declared stereotype value.voidaddDeclaredStereotype(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.voidaddDeclaredStereotype(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.final voidaddDefaultAnnotationValues(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.final voidaddDefaultAnnotationValues(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.voidaddRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable annotation value.voidaddRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue, RetentionPolicy retentionPolicy) Adds a repeatable annotation value.voidaddRepeatableStereotype(List<String> parents, String stereotype, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable stereotype value.final voidaddStereotype(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.final voidaddStereotype(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.clone()static voidcontributeDefaults(io.micronaut.core.annotation.AnnotationMetadata target, io.micronaut.core.annotation.AnnotationMetadata source) Contributes defaults to the given target.static voidcontributeDefaults(io.micronaut.core.annotation.AnnotationMetadata target, AnnotationMetadataHierarchy source) Contributes defaults to the given target.static voidcontributeRepeatable(io.micronaut.core.annotation.AnnotationMetadata target, io.micronaut.core.annotation.AnnotationMetadata source) Contributes repeatable annotation metadata to the given target.protected StringfindRepeatableAnnotationContainerInternal(String annotation) Find annotation's repeatable container.@NonNull Map<CharSequence,Object> getDefaultValues(@NonNull String annotation) booleanbooleanstatic MutableAnnotationMetadatamutateMember(MutableAnnotationMetadata annotationMetadata, String annotationName, String member, Object value) Sets a member of the givenAnnotationMetadatareturn a new annotation metadata instance without mutating the existing.static MutableAnnotationMetadatamutateMember(MutableAnnotationMetadata annotationMetadata, String annotationName, Map<CharSequence, Object> members) Sets a member of the givenAnnotationMetadatareturn a new annotation metadata instance without mutating the existing.protected <T extends Annotation>
io.micronaut.core.annotation.AnnotationValue<T>newAnnotationValue(String annotationType, Map<CharSequence, Object> values) static MutableAnnotationMetadataof(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) voidremoveAnnotation(String annotationType) Removes an annotation for the given annotation type.<A extends Annotation>
voidremoveAnnotationIf(@NonNull Predicate<io.micronaut.core.annotation.AnnotationValue<A>> predicate) Removes an annotation for the given predicate.voidremoveStereotype(String annotationType) Removes a stereotype annotation for the given annotation type.<T extends Annotation>
Tsynthesize(@NonNull Class<T> annotationClass) <T extends Annotation>
Tsynthesize(@NonNull Class<T> annotationClass, @NonNull String sourceAnnotation) @NonNull Annotation[]@NonNull Annotation[]<T extends Annotation>
TsynthesizeDeclared(@NonNull Class<T> annotationClass) <T extends Annotation>
TsynthesizeDeclared(@NonNull Class<T> annotationClass, @NonNull String sourceAnnotation) Methods inherited from class io.micronaut.inject.annotation.DefaultAnnotationMetadata
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, cloneMap, cloneMapOfListValue, cloneMapOfMapValue, copyAnnotationMetadata, 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, registerAnnotationDefaults, registerAnnotationDefaults, registerAnnotationType, registerRepeatableAnnotations, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesizeAnnotationsByType, synthesizeDeclaredAnnotationsByTypeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
booleanValue, booleanValue, classValue, classValue, classValues, classValues, doubleValue, enumValuesSet, enumValuesSet, findAnnotation, findDeclaredAnnotation, getAnnotationNameByStereotype, getAnnotationNamesByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDefaultValue, getDefaultValue, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, hasAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotypeNonRepeating, intValue, isAnnotationPresent, isAnnotationPresent, isDeclaredAnnotationPresent, isDeclaredAnnotationPresent, isFalse, isPresent, stringValue, stringValue, stringValues, stringValuesMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, synthesize, synthesize, synthesizeAll, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared
-
Constructor Details
-
MutableAnnotationMetadata
public MutableAnnotationMetadata()Default constructor.
-
-
Method Details
-
of
public static MutableAnnotationMetadata of(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) -
hasPropertyExpressions
public boolean hasPropertyExpressions()- Specified by:
hasPropertyExpressionsin interfaceio.micronaut.core.annotation.AnnotationMetadata- Overrides:
hasPropertyExpressionsin classDefaultAnnotationMetadata
-
hasEvaluatedExpressions
public boolean hasEvaluatedExpressions()- Specified by:
hasEvaluatedExpressionsin interfaceio.micronaut.core.annotation.AnnotationMetadata- Overrides:
hasEvaluatedExpressionsin classDefaultAnnotationMetadata
-
clone
- Overrides:
clonein classDefaultAnnotationMetadata
-
getDefaultValues
@NonNull public @NonNull Map<CharSequence,Object> getDefaultValues(@NonNull @NonNull String annotation) - Specified by:
getDefaultValuesin interfaceio.micronaut.core.annotation.AnnotationMetadata- Overrides:
getDefaultValuesin classDefaultAnnotationMetadata
-
addAnnotation
Adds an annotation and its member values, if the annotation already exists the data will be merged with existing values replaced.- Parameters:
annotation- The annotationvalues- The values
-
addAnnotation
public 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.- Parameters:
annotation- The annotationvalues- The valuesretentionPolicy- The retention policy
-
addDefaultAnnotationValues
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.- Parameters:
annotation- The annotationvalues- The values
-
addDefaultAnnotationValues
public final void addDefaultAnnotationValues(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.- Parameters:
annotation- The annotationvalues- The valuesretentionPolicy- The retention policy
-
addRepeatable
public void addRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable annotation value. If a value already exists will be added- Parameters:
annotationName- The annotation nameannotationValue- The annotation value
-
addRepeatable
public void addRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue, RetentionPolicy retentionPolicy) Adds a repeatable annotation value. If a value already exists will be added- Parameters:
annotationName- The annotation nameannotationValue- The annotation valueretentionPolicy- The retention policy
-
addRepeatableStereotype
public void addRepeatableStereotype(List<String> parents, String stereotype, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable stereotype value. If a value already exists will be added- Parameters:
parents- The parent annotationsstereotype- The annotation nameannotationValue- The annotation value
-
addDeclaredRepeatableStereotype
public void addDeclaredRepeatableStereotype(List<String> parents, String stereotype, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable declared stereotype value. If a value already exists will be added- Parameters:
parents- The parent annotationsstereotype- The annotation nameannotationValue- The annotation value
-
addDeclaredRepeatable
public void addDeclaredRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue) Adds a repeatable annotation value. If a value already exists will be added- Parameters:
annotationName- The annotation nameannotationValue- The annotation value
-
addDeclaredRepeatable
public void addDeclaredRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue<?> annotationValue, RetentionPolicy retentionPolicy) Adds a repeatable annotation value. If a value already exists will be added- Parameters:
annotationName- The annotation nameannotationValue- The annotation valueretentionPolicy- The retention policy
-
addStereotype
public final 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.- Parameters:
parentAnnotations- The parent annotationsstereotype- The annotationvalues- The values
-
addStereotype
public final 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.- Parameters:
parentAnnotations- The parent annotationsstereotype- The annotationvalues- The valuesretentionPolicy- The retention policy
-
addDeclaredStereotype
public 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.- Parameters:
parentAnnotations- The parent annotationsstereotype- The annotationvalues- The values
-
addDeclaredStereotype
public 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.- Parameters:
parentAnnotations- The parent annotationsstereotype- The annotationvalues- The valuesretentionPolicy- The retention policy
-
addDeclaredAnnotation
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.- Parameters:
annotation- The annotationvalues- The values
-
addDeclaredAnnotation
public 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.- Parameters:
annotation- The annotationvalues- The valuesretentionPolicy- The retention policy
-
mutateMember
@Internal public static MutableAnnotationMetadata mutateMember(MutableAnnotationMetadata annotationMetadata, String annotationName, String member, Object value) Sets a member of the given
AnnotationMetadatareturn a new annotation metadata instance without mutating the existing.WARNING: for internal use only be the framework
- Parameters:
annotationMetadata- The metadataannotationName- The annotation namemember- The membervalue- The value- Returns:
- The metadata
-
newAnnotationValue
protected <T extends Annotation> io.micronaut.core.annotation.AnnotationValue<T> newAnnotationValue(String annotationType, Map<CharSequence, Object> values) - Overrides:
newAnnotationValuein classDefaultAnnotationMetadata
-
addAnnotationMetadata
Include the annotation metadata from the other instance ofDefaultAnnotationMetadata.- Parameters:
annotationMetadata- The annotation metadata- Since:
- 4.0.0
-
addAnnotationMetadata
Include the annotation metadata from the other instance ofDefaultAnnotationMetadata.- Parameters:
annotationMetadata- The annotation metadata- Since:
- 4.0.0
-
contributeDefaults
@Internal public static void contributeDefaults(io.micronaut.core.annotation.AnnotationMetadata target, io.micronaut.core.annotation.AnnotationMetadata source) Contributes defaults to the given target.WARNING: for internal use only be the framework
- Parameters:
target- The targetsource- The source
-
contributeDefaults
@Internal public static void contributeDefaults(io.micronaut.core.annotation.AnnotationMetadata target, AnnotationMetadataHierarchy source) Contributes defaults to the given target.WARNING: for internal use only be the framework
- Parameters:
target- The targetsource- The source- Since:
- 4.0.0
-
contributeRepeatable
@Internal public static void contributeRepeatable(io.micronaut.core.annotation.AnnotationMetadata target, io.micronaut.core.annotation.AnnotationMetadata source) Contributes repeatable annotation metadata to the given target.WARNING: for internal use only be the framework
- Parameters:
target- The targetsource- The source
-
mutateMember
@Internal public static MutableAnnotationMetadata mutateMember(MutableAnnotationMetadata annotationMetadata, String annotationName, Map<CharSequence, Object> members) Sets a member of the given
AnnotationMetadatareturn a new annotation metadata instance without mutating the existing.WARNING: for internal use only be the framework
- Parameters:
annotationMetadata- The metadataannotationName- The annotation namemembers- The key/value set of members and values- Returns:
- The metadata
-
removeAnnotationIf
public <A extends Annotation> void removeAnnotationIf(@NonNull @NonNull Predicate<io.micronaut.core.annotation.AnnotationValue<A>> predicate) Removes an annotation for the given predicate.- Type Parameters:
A- The annotation- Parameters:
predicate- The predicate
-
removeAnnotation
Removes an annotation for the given annotation type.- Parameters:
annotationType- The annotation type- Since:
- 3.0.0
-
removeStereotype
Removes a stereotype annotation for the given annotation type.- Parameters:
annotationType- The annotation type- Since:
- 3.0.0
-
findRepeatableAnnotationContainerInternal
Description copied from class:DefaultAnnotationMetadataFind annotation's repeatable container.- Overrides:
findRepeatableAnnotationContainerInternalin classDefaultAnnotationMetadata- Parameters:
annotation- The annotation- Returns:
- the repeatable container or null
-
synthesize
- Specified by:
synthesizein interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesize
@Nullable public <T extends Annotation> T synthesize(@NonNull @NonNull Class<T> annotationClass, @NonNull @NonNull String sourceAnnotation) - Specified by:
synthesizein interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@Nullable public <T extends Annotation> T synthesizeDeclared(@NonNull @NonNull Class<T> annotationClass, @NonNull @NonNull String sourceAnnotation) - Specified by:
synthesizeDeclaredin interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
@Nullable public <T extends Annotation> T synthesizeDeclared(@NonNull @NonNull Class<T> annotationClass) - Specified by:
synthesizeDeclaredin interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeAll
- Specified by:
synthesizeAllin interfaceio.micronaut.core.annotation.AnnotationSource
-
synthesizeDeclared
- Specified by:
synthesizeDeclaredin interfaceio.micronaut.core.annotation.AnnotationSource
-