Interface AnnotationTransformation.TransformationContext

All Known Implementing Classes:
AnnotationOverlayImpl.TransformationContextImpl
Enclosing interface:
AnnotationTransformation

public static interface AnnotationTransformation.TransformationContext
A transformation context. Passed as a singular parameter to AnnotationTransformation.apply(TransformationContext).
See Also:
  • Method Details

    • declaration

      Declaration declaration()
      Returns the declaration that is being transformed.
      Returns:
      the declaration that is being transformed
    • annotations

      Returns the collection of annotations present on the declaration that is being transformed. Reflects all changes done by this annotation transformation and all annotation transformations executed prior to this one.

      Changes made directly to this collection and changes made through the other TransformationContext methods are interchangeable.

      Returns:
      the collection of annotations present on the declaration that is being transformed
    • hasAnnotation

      boolean hasAnnotation(Class<? extends Annotation> annotationClass)
      Returns whether the current set of annotations contains an annotation of given annotationClass.
      Parameters:
      annotationClass - the annotation class, must not be null
      Returns:
      whether the current set of annotations contains an annotation of given class
    • hasAnnotation

      boolean hasAnnotation(DotName annotationName)
      Returns whether the current set of annotations contains an annotation whose class has given annotationName.
      Parameters:
      annotationName - name of the annotation class, must not be null
      Returns:
      whether the current set of annotations contains an annotation of given class
    • hasAnnotation

      boolean hasAnnotation(Predicate<AnnotationInstance> predicate)
      Returns whether the current set of annotations contains an annotation that matches given predicate.
      Parameters:
      predicate - the predicate, must not be null
      Returns:
      whether the current set of annotations contains an annotation of given class
    • add

      void add(Class<? extends Annotation> annotationClass)
      Adds an annotation of given annotationClass to the current set of annotations.

      The annotation type must have no members.

      Parameters:
      annotationClass - the class of annotation to add, must not be null
    • add

      void add(AnnotationInstance annotation)
      Adds the annotation to the current set of annotations.
      Parameters:
      annotation - the annotation to add, must not be null
    • addAll

      void addAll(AnnotationInstance... annotations)
      Adds all annotations to the current set of annotations.
      Parameters:
      annotations - the annotations to add, must not be null
    • addAll

      void addAll(Collection<AnnotationInstance> annotations)
      Adds all annotations to the current set of annotations.
      Parameters:
      annotations - the annotations to add, must not be null
    • remove

      void remove(Predicate<AnnotationInstance> predicate)
      Removes annotations that match given predicate from the current set of annotations.
      Parameters:
      predicate - the annotation predicate, must not be null
    • removeAll

      void removeAll()
      Removes all annotations from current set of annotations.