Interface MutableAnnotationMetadataDelegate<R>

Type Parameters:
R - The return type
All Superinterfaces:
AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource
All Known Subinterfaces:
AnnotationElement, ArrayableClassElement, BeanConstructorElement, BeanElement, BeanElementBuilder, BeanFieldElement, BeanMethodElement, BeanParameterElement, ClassElement, ConfigurableElement, ConstructorElement, Element, ElementAnnotationMetadata, ElementMutableAnnotationMetadataDelegate<R>, EnumConstantElement, EnumElement, FieldElement, GenericPlaceholderElement, InjectableElement, MemberElement, MethodElement, PackageElement, ParameterElement, PropertyElement, TypedElement, WildcardElement
All Known Implementing Classes:
AbstractBeanDefinitionBuilder, AbstractElementAnnotationMetadataFactory.AbstractElementAnnotationMetadata, AbstractGroovyElement, AbstractJavaElement, BeanDefinitionWriter, GroovyClassElement, GroovyConstructorElement, GroovyEnumConstantElement, GroovyFieldElement, GroovyMethodElement, GroovyPackageElement, GroovyParameterElement, JavaClassElement, JavaMethodElement, JavaPackageElement, PrimitiveElement

public interface MutableAnnotationMetadataDelegate<R> extends AnnotationMetadataDelegate
Mutable annotation metadata.
Since:
4.0.0
Author:
Denis Stepanov
  • Method Details

    • annotate

      @NonNull default <T extends Annotation> R annotate(@NonNull String annotationType, @NonNull Consumer<AnnotationValueBuilder<T>> consumer)
      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.
      Type Parameters:
      T - The annotation generic type
      Parameters:
      annotationType - The annotation type
      consumer - A function that receives the AnnotationValueBuilder
      Returns:
      This element
    • removeAnnotation

      @NonNull default R removeAnnotation(@NonNull String annotationType)
      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.

      Parameters:
      annotationType - The annotation type
      Returns:
      This element
    • removeAnnotation

      @NonNull default <T extends Annotation> R removeAnnotation(@NonNull Class<T> annotationType)
      Type Parameters:
      T - The annotation generic type
      Parameters:
      annotationType - The annotation type
      Returns:
      This element
      See Also:
    • removeAnnotationIf

      @NonNull default <T extends Annotation> R removeAnnotationIf(@NonNull Predicate<AnnotationValue<T>> predicate)
      Removes all annotations that pass the given predicate.
      Type Parameters:
      T - The annotation generic type
      Parameters:
      predicate - The predicate
      Returns:
      This element
    • removeStereotype

      @NonNull default R removeStereotype(@NonNull String annotationType)
      Removes a stereotype of the given name from the element.
      Parameters:
      annotationType - The annotation type
      Returns:
      This element
    • removeStereotype

      @NonNull default <T extends Annotation> R removeStereotype(@NonNull Class<T> annotationType)
      Removes a stereotype annotation of the given type from the element.
      Type Parameters:
      T - The annotation generic type
      Parameters:
      annotationType - The annotation type
      Returns:
      This element
    • annotate

      @NonNull default R annotate(@NonNull String annotationType)
      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.
      Parameters:
      annotationType - The annotation type
      Returns:
      This element
    • annotate

      @NonNull default <T extends Annotation> R annotate(@NonNull Class<T> annotationType, @NonNull Consumer<AnnotationValueBuilder<T>> consumer)
      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.
      Type Parameters:
      T - The annotation generic type
      Parameters:
      annotationType - The annotation type
      consumer - A function that receives the AnnotationValueBuilder
      Returns:
      This element
    • annotate

      @NonNull default <T extends Annotation> R annotate(@NonNull Class<T> annotationType)
      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.
      Type Parameters:
      T - The annotation generic type
      Parameters:
      annotationType - The annotation type
      Returns:
      This element
    • annotate

      @NonNull default <T extends Annotation> R annotate(@NonNull AnnotationValue<T> annotationValue)
      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.
      Type Parameters:
      T - The annotation generic type
      Parameters:
      annotationValue - The annotation type
      Returns:
      This element
      Since:
      3.0.0