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, GenericElement, GenericPlaceholderElement, InjectableElement, KotlinParameterElement, MemberElement, MethodElement, PackageElement, ParameterElement, PropertyElement, TypedElement, WildcardElement
All Known Implementing Classes:
AbstractAnnotationElement, AbstractBeanDefinitionBuilder, AbstractElementAnnotationMetadata, AbstractElementAnnotationMetadataFactory.AbstractElementAnnotationMetadata, AbstractElementAnnotationMetadataFactory.MutableElementAnnotationMetadata, AbstractGroovyElement, AbstractJavaElement, AbstractJavaMemberElement, AbstractMutableAnnotationMetadata, AbstractTypeAwareJavaElement, BeanDefinitionWriter, GenericPlaceholderElementAnnotationMetadata, GroovyClassElement, GroovyConstructorElement, GroovyEnumConstantElement, GroovyFieldElement, GroovyMethodElement, GroovyPackageElement, GroovyParameterElement, JavaClassElement, JavaMethodElement, JavaPackageElement, MethodElementAnnotationMetadata, MutatedMethodElementAnnotationMetadata, PrimitiveElement, PropertyElementAnnotationMetadata, WildcardElementAnnotationMetadata

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

  • Method Details

    • annotate

      default <T extends Annotation> @NonNull 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

      default @NonNull 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

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

      default <T extends Annotation> @NonNull 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

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

      default <T extends Annotation> @NonNull 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

      default @NonNull 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

      default <T extends Annotation> @NonNull 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

      default <T extends Annotation> @NonNull 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

      default <T extends Annotation> @NonNull 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