Class AnnotationContainer

java.lang.Object
io.spring.initializr.generator.language.AnnotationContainer

public class AnnotationContainer extends Object
A container for annotations defined on an annotated element.
Author:
Stephane Nicoll
  • Constructor Details

    • AnnotationContainer

      public AnnotationContainer()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specify if this container is empty.
      Returns:
      true if no annotation is registered
    • has

      public boolean has(ClassName className)
      Specify if this container has a an annotation with the specified ClassName.
      Parameters:
      className - the class name of an annotation
      Returns:
      true if the annotation with the specified class name exists
    • values

      public Stream<Annotation> values()
      Return the annotations.
      Returns:
      the annotations
    • add

      public void add(ClassName className, Consumer<Annotation.Builder> annotation)
      Add a single Annotation with the specified class name and Consumer to customize it. If the annotation has already been added, the consumer can be used to further tune attributes
      Parameters:
      className - the class name of an annotation
      annotation - a Consumer to customize the Annotation
    • add

      public void add(ClassName className)
      Add a single Annotation with the specified class name. Does nothing If the annotation has already been added.
      Parameters:
      className - the class name of an annotation
    • remove

      public boolean remove(ClassName className)
      Remove the annotation with the specified ClassName.
      Parameters:
      className - the class name of the annotation
      Returns:
      true if such an annotation exists, false otherwise
    • deepCopy

      public AnnotationContainer deepCopy()