Class AbstractElementAnnotationMetadataFactory.MutableElementAnnotationMetadata
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractElementAnnotationMetadataFactory.MutableElementAnnotationMetadata
- All Implemented Interfaces:
AnnotationMetadata
,AnnotationMetadataDelegate
,AnnotationMetadataProvider
,AnnotationSource
,ElementAnnotationMetadata
,MutableAnnotationMetadataDelegate<AnnotationMetadata>
- Direct Known Subclasses:
AbstractElementAnnotationMetadataFactory.AbstractElementAnnotationMetadata
- Enclosing class:
- AbstractElementAnnotationMetadataFactory<K,
A>
protected abstract class AbstractElementAnnotationMetadataFactory.MutableElementAnnotationMetadata
extends Object
implements ElementAnnotationMetadata
Abstract mutable implementation of
ElementAnnotationMetadata
.- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
Fields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate
EMPTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends Annotation>
AnnotationMetadataAnnotate this element with the given annotation type.<T extends Annotation>
AnnotationMetadataannotate
(AnnotationValue<T> annotationValue) Annotate this element with the given annotation type.protected abstract AnnotationMetadata
Return the annotation metadata to modify.removeAnnotation
(@NonNull String annotationType) Removes an annotation of the given type from the element.<T extends Annotation>
AnnotationMetadataremoveAnnotationIf
(@NonNull Predicate<AnnotationValue<T>> predicate) Removes all annotations that pass the given predicate.removeStereotype
(@NonNull String annotationType) Removes a stereotype of the given name from the element.protected abstract AnnotationMetadata
replaceAnnotationsInternal
(AnnotationMetadata annotationMetadata) Replaces existing annotation metadata.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadata
Methods inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate
annotate, annotate, annotate, removeAnnotation, removeStereotype
-
Constructor Details
-
MutableElementAnnotationMetadata
protected MutableElementAnnotationMetadata()
-
-
Method Details
-
getAnnotationMetadataToModify
Return the annotation metadata to modify.- Returns:
- The annotation metadata to modify
-
replaceAnnotationsInternal
protected abstract AnnotationMetadata replaceAnnotationsInternal(AnnotationMetadata annotationMetadata) Replaces existing annotation metadata.- Parameters:
annotationMetadata
- new annotation metadata- Returns:
- The annotation metadata
-
annotate
public <T extends Annotation> AnnotationMetadata annotate(@NonNull @NonNull String annotationType, @NonNull @NonNull Consumer<AnnotationValueBuilder<T>> consumer) Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<AnnotationMetadata>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationType
- The annotation typeconsumer
- A function that receives theAnnotationValueBuilder
- Returns:
- This element
-
annotate
Description copied from interface:MutableAnnotationMetadataDelegate
Annotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotate
in interfaceMutableAnnotationMetadataDelegate<AnnotationMetadata>
- Type Parameters:
T
- The annotation generic type- Parameters:
annotationValue
- The annotation type- Returns:
- This element
-
removeAnnotation
Description copied from interface:MutableAnnotationMetadataDelegate
Removes an annotation of the given type from the element.If the annotation features any stereotypes these will also be removed unless there are other annotations that reference the stereotype to be removed.
In the case of repeatable annotations this method will remove all repeated annotations, effectively clearing out all declared repeated annotations of the given type.
- Specified by:
removeAnnotation
in interfaceMutableAnnotationMetadataDelegate<AnnotationMetadata>
- Parameters:
annotationType
- The annotation type- Returns:
- This element
-
removeAnnotationIf
public <T extends Annotation> AnnotationMetadata removeAnnotationIf(@NonNull @NonNull Predicate<AnnotationValue<T>> predicate) Description copied from interface:MutableAnnotationMetadataDelegate
Removes all annotations that pass the given predicate.- Specified by:
removeAnnotationIf
in interfaceMutableAnnotationMetadataDelegate<AnnotationMetadata>
- Type Parameters:
T
- The annotation generic type- Parameters:
predicate
- The predicate- Returns:
- This element
-
removeStereotype
Description copied from interface:MutableAnnotationMetadataDelegate
Removes a stereotype of the given name from the element.- Specified by:
removeStereotype
in interfaceMutableAnnotationMetadataDelegate<AnnotationMetadata>
- Parameters:
annotationType
- The annotation type- Returns:
- This element
-