Class 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 of DefaultAnnotationMetadata that is used only at build time.
    Since:
    2.4.0
    • Field Detail

      • annotationMap

        protected final java.util.Map<java.lang.String,​java.lang.annotation.Annotation> annotationMap
      • declaredAnnotationMap

        protected final java.util.Map<java.lang.String,​java.lang.annotation.Annotation> declaredAnnotationMap
    • Constructor Detail

      • MutableAnnotationMetadata

        public MutableAnnotationMetadata()
        Default constructor.
    • Method Detail

      • hasPropertyExpressions

        public boolean hasPropertyExpressions()
        Specified by:
        hasPropertyExpressions in interface io.micronaut.core.annotation.AnnotationMetadata
        Overrides:
        hasPropertyExpressions in class DefaultAnnotationMetadata
      • getDefaultValues

        @NonNull
        public java.util.Map<java.lang.String,​java.lang.Object> getDefaultValues​(@NonNull
                                                                                       java.lang.String annotation)
        Specified by:
        getDefaultValues in interface io.micronaut.core.annotation.AnnotationMetadata
        Overrides:
        getDefaultValues in class DefaultAnnotationMetadata
      • 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 class DefaultAnnotationMetadata
        Type Parameters:
        A - The annotation
        Parameters:
        predicate - The predicate
      • 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 class DefaultAnnotationMetadata
        Parameters:
        annotation - The annotation
        values - 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 class DefaultAnnotationMetadata
        Parameters:
        annotation - The annotation
        values - The values
        retentionPolicy - 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 class DefaultAnnotationMetadata
        Parameters:
        parents - The parent annotations
        stereotype - The annotation name
        annotationValue - 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 class DefaultAnnotationMetadata
        Parameters:
        parents - The parent annotations
        stereotype - The annotation name
        annotationValue - 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 class DefaultAnnotationMetadata
        Parameters:
        annotation - The annotation
        values - 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 class DefaultAnnotationMetadata
        Parameters:
        annotation - The annotation
        values - The values
        retentionPolicy - 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 class DefaultAnnotationMetadata
        Parameters:
        annotationName - The annotation name
        annotationValue - 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 class DefaultAnnotationMetadata
        Parameters:
        annotationName - The annotation name
        annotationValue - The annotation value
        retentionPolicy - 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 class DefaultAnnotationMetadata
        Parameters:
        annotationName - The annotation name
        annotationValue - 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 class DefaultAnnotationMetadata
        Parameters:
        annotationName - The annotation name
        annotationValue - The annotation value
        retentionPolicy - 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 class DefaultAnnotationMetadata
        Parameters:
        parentAnnotations - The parent annotations
        stereotype - The annotation
        values - 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 class DefaultAnnotationMetadata
        Parameters:
        parentAnnotations - The parent annotations
        stereotype - The annotation
        values - The values
        retentionPolicy - The retention policy
      • synthesize

        @Nullable
        public <T extends java.lang.annotation.Annotation> T synthesize​(@NonNull
                                                                        java.lang.Class<T> annotationClass)
        Specified by:
        synthesize in interface io.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 interface io.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 interface io.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 interface io.micronaut.core.annotation.AnnotationSource
      • synthesizeAll

        @NonNull
        public java.lang.annotation.Annotation[] synthesizeAll()
        Specified by:
        synthesizeAll in interface io.micronaut.core.annotation.AnnotationSource
      • synthesizeDeclared

        @NonNull
        public java.lang.annotation.Annotation[] synthesizeDeclared()
        Specified by:
        synthesizeDeclared in interface io.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 results
        values - 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 results
        values - The values