Package io.micronaut.inject.annotation
Class AbstractAnnotationMetadataBuilder<T,A>
- java.lang.Object
-
- io.micronaut.inject.annotation.AbstractAnnotationMetadataBuilder<T,A>
-
- Type Parameters:
T
- The element typeA
- The annotation type
public abstract class AbstractAnnotationMetadataBuilder<T,A> extends java.lang.Object
An abstract implementation that buildsAnnotationMetadata
.- Since:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAnnotationMetadataBuilder()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addError(T originatingElement, java.lang.String error)
Adds an error.static void
addMutatedMetadata(java.lang.String declaringType, java.lang.Object element, io.micronaut.core.annotation.AnnotationMetadata metadata)
Used to store metadata mutations at compilation time.protected abstract void
addWarning(T originatingElement, java.lang.String warning)
Adds an warning.<A2 extends java.lang.annotation.Annotation>
io.micronaut.core.annotation.AnnotationMetadataannotate(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.annotation.AnnotationValue<A2> annotationValue)
Annotate an existing annotation metadata object.io.micronaut.core.annotation.AnnotationMetadata
build(java.lang.String declaringType, T element)
Build the meta data for the given element.io.micronaut.core.annotation.AnnotationMetadata
build(T element)
Build the meta data for the given element.io.micronaut.core.annotation.AnnotationMetadata
buildDeclared(T element)
Build only metadata for declared annotations.io.micronaut.core.annotation.AnnotationMetadata
buildDeclared(T element, java.util.List<? extends A> annotations, boolean includeTypeAnnotations)
Build only metadata for declared annotations.io.micronaut.core.annotation.AnnotationMetadata
buildForMethod(T element)
Build the meta data for the given method element excluding any class metadata.io.micronaut.core.annotation.AnnotationMetadata
buildForParent(java.lang.String declaringType, T parent, T element)
Build the meta data for the given parent and method element excluding any class metadata.io.micronaut.core.annotation.AnnotationMetadata
buildForParent(T parent, T element)
Get the annotation metadata for the given element and the given parent.io.micronaut.core.annotation.AnnotationMetadata
buildForParent(T parent, T element, boolean inheritTypeAnnotations)
Build the meta data for the given method element excluding any class metadata.io.micronaut.core.annotation.AnnotationMetadata
buildForParents(java.lang.String declaringType, java.util.List<T> parents, T element)
Build the meta data for the given parents and method element excluding any class metadata.io.micronaut.core.annotation.AnnotationMetadata
buildForParents(java.util.List<T> parents, T element)
Get the annotation metadata for the given element and the given parents.protected abstract java.util.List<T>
buildHierarchy(T element, boolean inheritTypeAnnotations, boolean declaredOnly)
Build the type hierarchy for the given element.io.micronaut.core.annotation.AnnotationMetadata
buildOverridden(T element)
Build metadata for the given element, including any metadata that is inherited via method or type overrides.static void
clearCaches()
Used to clear caches at the end of a compilation cycle.static void
clearMutated()
Used to clear mutated metadata at the end of a compilation cycle.static void
copyToRuntime()
This is used for testing scenarios only where annotation metadata is created without bean creation.protected abstract VisitorContext
createVisitorContext()
Creates the visitor context for this implementation.protected java.util.List<AnnotationMapper<? extends java.lang.annotation.Annotation>>
getAnnotationMappers(java.lang.String annotationName)
Obtain the annotation mappers for the given annotation name.protected abstract T
getAnnotationMember(T originatingElement, java.lang.CharSequence member)
Get the annotation member.protected abstract java.lang.String
getAnnotationMemberName(T member)
Read the name of an annotation member.protected abstract java.util.Map<java.lang.String,? extends T>
getAnnotationMembers(java.lang.String annotationType)
Gets the annotation members for the given type.protected abstract java.util.Optional<T>
getAnnotationMirror(java.lang.String annotationName)
Return a mirror for the given annotation.protected abstract java.util.List<? extends A>
getAnnotationsForType(T element)
Obtain the annotations for the given type.protected java.util.List<AnnotationTransformer<java.lang.annotation.Annotation>>
getAnnotationTransformers(java.lang.String annotationName)
Obtain the transformers mappers for the given annotation name.protected abstract java.lang.String
getAnnotationTypeName(A annotationMirror)
Get the given type of the annotation.protected abstract io.micronaut.core.value.OptionalValues<?>
getAnnotationValues(T originatingElement, T member, java.lang.Class<?> annotationType)
Resolve the annotations values from the given member for the given type.protected abstract java.lang.String
getDeclaringType(T element)
Obtains the declaring type for an element.protected abstract java.lang.String
getElementName(T element)
Get the name for the given element.protected AnnotatedElementValidator
getElementValidator()
Obtains the element validator.static java.util.Set<java.lang.String>
getMappedAnnotationNames()
static java.util.Set<java.lang.String>
getMappedAnnotationPackages()
protected abstract java.lang.String
getRepeatableName(A annotationMirror)
Obtain the name of the repeatable annotation if the annotation is is one.protected abstract java.lang.String
getRepeatableNameForType(T annotationType)
Obtain the name of the repeatable annotation if the annotation is is one.protected abstract java.lang.annotation.RetentionPolicy
getRetentionPolicy(T annotation)
Gets the retention policy for the given annotation.protected abstract T
getTypeForAnnotation(A annotationMirror)
Get the type of the given annotation.protected abstract boolean
hasAnnotation(T element, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether an annotation is present.protected abstract boolean
hasAnnotation(T element, java.lang.String annotation)
Checks whether an annotation is present.protected abstract boolean
hasAnnotations(T element)
Checks whether any annotations are present on the given element.protected abstract boolean
hasSimpleAnnotation(T element, java.lang.String simpleName)
Returns true if a simple meta annotation is present for the given element and annotation type.static boolean
isAnnotationMapped(java.lang.String annotationName)
Returns whether the given annotation is a mapped annotation.protected boolean
isExcludedAnnotation(T element, java.lang.String annotationName)
Is the given annotation excluded for the specified element.protected abstract boolean
isInheritedAnnotation(A annotationMirror)
Test whether the annotation mirror is inherited.protected abstract boolean
isInheritedAnnotationType(T annotationType)
Test whether the annotation mirror is inherited.static boolean
isMetadataMutated(java.lang.String declaringType, java.lang.Object element)
Used to store metadata mutations at compilation time.protected abstract boolean
isMethodOrClassElement(T element)
Whether the element is a field, method, class or constructor.protected abstract boolean
isValidationRequired(T member)
Return whether the given member requires validation.protected java.util.Map<java.lang.CharSequence,java.lang.Object>
populateAnnotationData(T originatingElement, boolean originatingElementIsSameParent, A annotationMirror, DefaultAnnotationMetadata metadata, boolean isDeclared, java.lang.annotation.RetentionPolicy retentionPolicy, boolean allowAliases)
Populate the annotation data for the given annotation.protected java.util.Map<java.lang.CharSequence,java.lang.Object>
populateAnnotationData(T originatingElement, T parent, A annotationMirror, DefaultAnnotationMetadata metadata, boolean isDeclared, java.lang.annotation.RetentionPolicy retentionPolicy, boolean allowAliases)
Populate the annotation data for the given annotation.protected abstract java.util.Map<? extends T,?>
readAnnotationDefaultValues(A annotationMirror)
Read the raw default annotation values from the given annotation.protected abstract java.util.Map<? extends T,?>
readAnnotationDefaultValues(java.lang.String annotationName, T annotationType)
Read the raw default annotation values from the given annotation.protected abstract java.util.Map<? extends T,?>
readAnnotationRawValues(A annotationMirror)
Read the raw annotation values from the given annotation.protected abstract void
readAnnotationRawValues(T originatingElement, java.lang.String annotationName, T member, java.lang.String memberName, java.lang.Object annotationValue, java.util.Map<java.lang.CharSequence,java.lang.Object> annotationValues)
Read the given member and value, applying conversions if necessary, and place the data in the given map.protected abstract java.lang.Object
readAnnotationValue(T originatingElement, T member, java.lang.String memberName, java.lang.Object annotationValue)
Read the given member and value, applying conversions if necessary, and place the data in the given map.protected io.micronaut.core.annotation.AnnotationValue
readNestedAnnotationValue(T originatingElement, A annotationMirror)
io.micronaut.core.annotation.AnnotationMetadata
removeAnnotation(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.String annotationType)
Removes an annotation from the given annotation metadata.<T1 extends java.lang.annotation.Annotation>
io.micronaut.core.annotation.AnnotationMetadataremoveAnnotationIf(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T1>> predicate)
Removes an annotation from the metadata for the given predicate.io.micronaut.core.annotation.AnnotationMetadata
removeStereotype(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.String annotationType)
Removes an annotation from the given annotation metadata.protected void
validateAnnotationValue(T originatingElement, java.lang.String annotationName, T member, java.lang.String memberName, java.lang.Object resolvedValue)
Validates an annotation value.
-
-
-
Method Detail
-
buildDeclared
public io.micronaut.core.annotation.AnnotationMetadata buildDeclared(T element)
Build only metadata for declared annotations.- Parameters:
element
- The element- Returns:
- The
AnnotationMetadata
-
buildDeclared
public io.micronaut.core.annotation.AnnotationMetadata buildDeclared(T element, java.util.List<? extends A> annotations, boolean includeTypeAnnotations)
Build only metadata for declared annotations.- Parameters:
element
- The elementannotations
- The annotationsincludeTypeAnnotations
- Whether to include type level annotations in the metadata for the element- Returns:
- The
AnnotationMetadata
-
buildOverridden
public io.micronaut.core.annotation.AnnotationMetadata buildOverridden(T element)
Build metadata for the given element, including any metadata that is inherited via method or type overrides.- Parameters:
element
- The element- Returns:
- The
AnnotationMetadata
-
build
public io.micronaut.core.annotation.AnnotationMetadata build(T element)
Build the meta data for the given element. If the element is a method the class metadata will be included.- Parameters:
element
- The element- Returns:
- The
AnnotationMetadata
-
build
public io.micronaut.core.annotation.AnnotationMetadata build(java.lang.String declaringType, T element)
Build the meta data for the given element. If the element is a method the class metadata will be included.- Parameters:
declaringType
- The declaring typeelement
- The element- Returns:
- The
AnnotationMetadata
-
isMethodOrClassElement
protected abstract boolean isMethodOrClassElement(T element)
Whether the element is a field, method, class or constructor.- Parameters:
element
- The element- Returns:
- True if it is
-
getDeclaringType
@Nullable protected abstract java.lang.String getDeclaringType(@NonNull T element)
Obtains the declaring type for an element.- Parameters:
element
- The element- Returns:
- The declaring type
-
buildForMethod
public io.micronaut.core.annotation.AnnotationMetadata buildForMethod(T element)
Build the meta data for the given method element excluding any class metadata.- Parameters:
element
- The element- Returns:
- The
AnnotationMetadata
-
buildForParent
public io.micronaut.core.annotation.AnnotationMetadata buildForParent(T parent, T element)
Get the annotation metadata for the given element and the given parent. This method is used for cases when you need to combine annotation metadata for two elements, for example a JavaBean property where the field and the method metadata need to be combined.- Parameters:
parent
- The parent elementelement
- The element- Returns:
- The
AnnotationMetadata
-
buildForParents
public io.micronaut.core.annotation.AnnotationMetadata buildForParents(java.util.List<T> parents, T element)
Get the annotation metadata for the given element and the given parents. This method is used for cases when you need to combine annotation metadata for two elements, for example a JavaBean property where the field and the method metadata need to be combined.- Parameters:
parents
- The parent elementselement
- The element- Returns:
- The
AnnotationMetadata
-
buildForParent
public io.micronaut.core.annotation.AnnotationMetadata buildForParent(java.lang.String declaringType, T parent, T element)
Build the meta data for the given parent and method element excluding any class metadata.- Parameters:
declaringType
- The declaring typeparent
- The parent elementelement
- The element- Returns:
- The
AnnotationMetadata
-
buildForParents
public io.micronaut.core.annotation.AnnotationMetadata buildForParents(java.lang.String declaringType, java.util.List<T> parents, T element)
Build the meta data for the given parents and method element excluding any class metadata.- Parameters:
declaringType
- The declaring typeparents
- The parent elementselement
- The element- Returns:
- The
AnnotationMetadata
-
buildForParent
public io.micronaut.core.annotation.AnnotationMetadata buildForParent(T parent, T element, boolean inheritTypeAnnotations)
Build the meta data for the given method element excluding any class metadata.- Parameters:
parent
- The parent elementelement
- The elementinheritTypeAnnotations
- Whether to inherit annotations from type as stereotypes- Returns:
- The
AnnotationMetadata
-
getTypeForAnnotation
protected abstract T getTypeForAnnotation(A annotationMirror)
Get the type of the given annotation.- Parameters:
annotationMirror
- The annotation- Returns:
- The type
-
hasAnnotation
protected abstract boolean hasAnnotation(T element, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Checks whether an annotation is present.- Parameters:
element
- The elementannotation
- The annotation type- Returns:
- True if the annotation is present
-
hasAnnotation
protected abstract boolean hasAnnotation(T element, java.lang.String annotation)
Checks whether an annotation is present.- Parameters:
element
- The elementannotation
- The annotation type name- Returns:
- True if the annotation is present
-
hasAnnotations
protected abstract boolean hasAnnotations(T element)
Checks whether any annotations are present on the given element.- Parameters:
element
- The element- Returns:
- True if the annotation is present
-
getAnnotationTypeName
protected abstract java.lang.String getAnnotationTypeName(A annotationMirror)
Get the given type of the annotation.- Parameters:
annotationMirror
- The annotation- Returns:
- The type
-
getElementName
protected abstract java.lang.String getElementName(T element)
Get the name for the given element.- Parameters:
element
- The element- Returns:
- The name
-
getAnnotationsForType
protected abstract java.util.List<? extends A> getAnnotationsForType(T element)
Obtain the annotations for the given type. This method is also responsible for unwrapping repeatable annotations. For example,@Parent(value = {@Child, @Child})
should result in the two child annotations being returned from this method instead of the parent annotation.- Parameters:
element
- The type element- Returns:
- The annotations
-
buildHierarchy
protected abstract java.util.List<T> buildHierarchy(T element, boolean inheritTypeAnnotations, boolean declaredOnly)
Build the type hierarchy for the given element.- Parameters:
element
- The elementinheritTypeAnnotations
- Whether to inherit type annotationsdeclaredOnly
- Whether to only include declared annotations- Returns:
- The type hierarchy
-
readAnnotationRawValues
protected abstract void readAnnotationRawValues(T originatingElement, java.lang.String annotationName, T member, java.lang.String memberName, java.lang.Object annotationValue, java.util.Map<java.lang.CharSequence,java.lang.Object> annotationValues)
Read the given member and value, applying conversions if necessary, and place the data in the given map.- Parameters:
originatingElement
- The originating elementannotationName
- The annotation namemember
- The member being read frommemberName
- The memberannotationValue
- The valueannotationValues
- The values to populate
-
validateAnnotationValue
protected void validateAnnotationValue(T originatingElement, java.lang.String annotationName, T member, java.lang.String memberName, java.lang.Object resolvedValue)
Validates an annotation value.- Parameters:
originatingElement
- The originating elementannotationName
- The annotation namemember
- The membermemberName
- The member nameresolvedValue
- The resolved value
-
isValidationRequired
protected abstract boolean isValidationRequired(T member)
Return whether the given member requires validation.- Parameters:
member
- The member- Returns:
- True if it is
-
getElementValidator
@Nullable protected AnnotatedElementValidator getElementValidator()
Obtains the element validator.- Returns:
- The validator.
-
addError
protected abstract void addError(@NonNull T originatingElement, @NonNull java.lang.String error)
Adds an error.- Parameters:
originatingElement
- The originating elementerror
- The error
-
addWarning
protected abstract void addWarning(@NonNull T originatingElement, @NonNull java.lang.String warning)
Adds an warning.- Parameters:
originatingElement
- The originating elementwarning
- The warning
-
readAnnotationValue
protected abstract java.lang.Object readAnnotationValue(T originatingElement, T member, java.lang.String memberName, java.lang.Object annotationValue)
Read the given member and value, applying conversions if necessary, and place the data in the given map.- Parameters:
originatingElement
- The originating elementmember
- The membermemberName
- The member nameannotationValue
- The value- Returns:
- The object
-
readAnnotationDefaultValues
protected abstract java.util.Map<? extends T,?> readAnnotationDefaultValues(A annotationMirror)
Read the raw default annotation values from the given annotation.- Parameters:
annotationMirror
- The annotation- Returns:
- The values
-
readAnnotationDefaultValues
protected abstract java.util.Map<? extends T,?> readAnnotationDefaultValues(java.lang.String annotationName, T annotationType)
Read the raw default annotation values from the given annotation.- Parameters:
annotationName
- annotation nameannotationType
- the type- Returns:
- The values
-
readAnnotationRawValues
protected abstract java.util.Map<? extends T,?> readAnnotationRawValues(A annotationMirror)
Read the raw annotation values from the given annotation.- Parameters:
annotationMirror
- The annotation- Returns:
- The values
-
getAnnotationValues
protected abstract io.micronaut.core.value.OptionalValues<?> getAnnotationValues(T originatingElement, T member, java.lang.Class<?> annotationType)
Resolve the annotations values from the given member for the given type.- Parameters:
originatingElement
- The originating elementmember
- The memberannotationType
- The type- Returns:
- The values
-
getAnnotationMemberName
protected abstract java.lang.String getAnnotationMemberName(T member)
Read the name of an annotation member.- Parameters:
member
- The member- Returns:
- The name
-
getRepeatableName
@Nullable protected abstract java.lang.String getRepeatableName(A annotationMirror)
Obtain the name of the repeatable annotation if the annotation is is one.- Parameters:
annotationMirror
- The annotation mirror- Returns:
- Return the name or null
-
getRepeatableNameForType
@Nullable protected abstract java.lang.String getRepeatableNameForType(T annotationType)
Obtain the name of the repeatable annotation if the annotation is is one.- Parameters:
annotationType
- The annotation mirror- Returns:
- Return the name or null
-
readNestedAnnotationValue
protected io.micronaut.core.annotation.AnnotationValue readNestedAnnotationValue(T originatingElement, A annotationMirror)
- Parameters:
originatingElement
- The originating elementannotationMirror
- The annotation- Returns:
- The annotation value
-
getAnnotationMirror
protected abstract java.util.Optional<T> getAnnotationMirror(java.lang.String annotationName)
Return a mirror for the given annotation.- Parameters:
annotationName
- The annotation name- Returns:
- An optional mirror
-
populateAnnotationData
protected java.util.Map<java.lang.CharSequence,java.lang.Object> populateAnnotationData(T originatingElement, @Nullable T parent, A annotationMirror, DefaultAnnotationMetadata metadata, boolean isDeclared, java.lang.annotation.RetentionPolicy retentionPolicy, boolean allowAliases)
Populate the annotation data for the given annotation.- Parameters:
originatingElement
- The element the annotation data originates fromparent
- The parent elementannotationMirror
- The annotationmetadata
- the metadataisDeclared
- Is the annotation a declared annotationretentionPolicy
- The retention policyallowAliases
- Whether aliases are allowed- Returns:
- The annotation values
-
populateAnnotationData
protected java.util.Map<java.lang.CharSequence,java.lang.Object> populateAnnotationData(T originatingElement, boolean originatingElementIsSameParent, A annotationMirror, DefaultAnnotationMetadata metadata, boolean isDeclared, java.lang.annotation.RetentionPolicy retentionPolicy, boolean allowAliases)
Populate the annotation data for the given annotation.- Parameters:
originatingElement
- The element the annotation data originates fromoriginatingElementIsSameParent
- Whether the originating element is considered a parent elementannotationMirror
- The annotationmetadata
- the metadataisDeclared
- Is the annotation a declared annotationretentionPolicy
- The retention policyallowAliases
- Whether aliases are allowed- Returns:
- The annotation values
-
getAnnotationMember
@Nullable protected abstract T getAnnotationMember(T originatingElement, java.lang.CharSequence member)
Get the annotation member.- Parameters:
originatingElement
- The originatig elementmember
- The member- Returns:
- The annotation member
-
getAnnotationMappers
@NonNull protected java.util.List<AnnotationMapper<? extends java.lang.annotation.Annotation>> getAnnotationMappers(@NonNull java.lang.String annotationName)
Obtain the annotation mappers for the given annotation name.- Parameters:
annotationName
- The annotation name- Returns:
- The mappers
-
getAnnotationTransformers
@NonNull protected java.util.List<AnnotationTransformer<java.lang.annotation.Annotation>> getAnnotationTransformers(@NonNull java.lang.String annotationName)
Obtain the transformers mappers for the given annotation name.- Parameters:
annotationName
- The annotation name- Returns:
- The transformers
-
createVisitorContext
protected abstract VisitorContext createVisitorContext()
Creates the visitor context for this implementation.- Returns:
- The visitor context
-
getRetentionPolicy
@NonNull protected abstract java.lang.annotation.RetentionPolicy getRetentionPolicy(@NonNull T annotation)
Gets the retention policy for the given annotation.- Parameters:
annotation
- The annotation- Returns:
- The retention policy
-
isExcludedAnnotation
protected boolean isExcludedAnnotation(@NonNull T element, @NonNull java.lang.String annotationName)
Is the given annotation excluded for the specified element.- Parameters:
element
- The elementannotationName
- The annotation name- Returns:
- True if it is excluded
-
isInheritedAnnotation
protected abstract boolean isInheritedAnnotation(@NonNull A annotationMirror)
Test whether the annotation mirror is inherited.- Parameters:
annotationMirror
- The mirror- Returns:
- True if it is
-
isInheritedAnnotationType
protected abstract boolean isInheritedAnnotationType(@NonNull T annotationType)
Test whether the annotation mirror is inherited.- Parameters:
annotationType
- The mirror- Returns:
- True if it is
-
getAnnotationMembers
@NonNull protected abstract java.util.Map<java.lang.String,? extends T> getAnnotationMembers(@NonNull java.lang.String annotationType)
Gets the annotation members for the given type.- Parameters:
annotationType
- The annotation type- Returns:
- The members
- Since:
- 3.3.0
-
hasSimpleAnnotation
protected abstract boolean hasSimpleAnnotation(T element, java.lang.String simpleName)
Returns true if a simple meta annotation is present for the given element and annotation type.- Parameters:
element
- The elementsimpleName
- The simple name, ieClass.getSimpleName()
- Returns:
- True an annotation with the given simple name exists on the element
-
addMutatedMetadata
@Internal public static void addMutatedMetadata(java.lang.String declaringType, java.lang.Object element, io.micronaut.core.annotation.AnnotationMetadata metadata)
Used to store metadata mutations at compilation time. Not for public consumption.- Parameters:
declaringType
- The declaring typeelement
- The elementmetadata
- The metadata
-
isMetadataMutated
@Internal public static boolean isMetadataMutated(java.lang.String declaringType, java.lang.Object element)
Used to store metadata mutations at compilation time. Not for public consumption.- Parameters:
declaringType
- The declaring typeelement
- The element- Returns:
- True if the annotation metadata was mutated
-
clearMutated
@Internal public static void clearMutated()
Used to clear mutated metadata at the end of a compilation cycle.
-
clearCaches
@Internal public static void clearCaches()
Used to clear caches at the end of a compilation cycle.
-
copyToRuntime
@Internal public static void copyToRuntime()
This is used for testing scenarios only where annotation metadata is created without bean creation. It is needed because at compile time there are no defaults added via DefaultAnnotationMetadata.
-
isAnnotationMapped
@Internal public static boolean isAnnotationMapped(@Nullable java.lang.String annotationName)
Returns whether the given annotation is a mapped annotation.- Parameters:
annotationName
- The annotation name- Returns:
- True if it is
-
getMappedAnnotationNames
@Internal public static java.util.Set<java.lang.String> getMappedAnnotationNames()
- Returns:
- Additional mapped annotation names
-
getMappedAnnotationPackages
@Internal public static java.util.Set<java.lang.String> getMappedAnnotationPackages()
- Returns:
- Additional mapped annotation names
-
annotate
public <A2 extends java.lang.annotation.Annotation> io.micronaut.core.annotation.AnnotationMetadata annotate(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.annotation.AnnotationValue<A2> annotationValue)
Annotate an existing annotation metadata object.- Type Parameters:
A2
- The annotation type- Parameters:
annotationMetadata
- The annotation metadataannotationValue
- The annotation value- Returns:
- The mutated metadata
-
removeAnnotation
public io.micronaut.core.annotation.AnnotationMetadata removeAnnotation(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.String annotationType)
Removes an annotation from the given annotation metadata.- Parameters:
annotationMetadata
- The annotation metadataannotationType
- The annotation type- Returns:
- The updated metadata
- Since:
- 3.0.0
-
removeStereotype
public io.micronaut.core.annotation.AnnotationMetadata removeStereotype(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, java.lang.String annotationType)
Removes an annotation from the given annotation metadata.- Parameters:
annotationMetadata
- The annotation metadataannotationType
- The annotation type- Returns:
- The updated metadata
- Since:
- 3.0.0
-
removeAnnotationIf
@NonNull public <T1 extends java.lang.annotation.Annotation> io.micronaut.core.annotation.AnnotationMetadata removeAnnotationIf(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull java.util.function.Predicate<io.micronaut.core.annotation.AnnotationValue<T1>> predicate)
Removes an annotation from the metadata for the given predicate.- Type Parameters:
T1
- The annotation type- Parameters:
annotationMetadata
- The annotation metadatapredicate
- The predicate- Returns:
- The potentially modified metadata
-
-