Interface AnnotationCreator

All Known Implementing Classes:
AnnotationCreatorImpl

public interface AnnotationCreator
  • Method Details

    • of

      static AnnotationCreator of(String annotationType)
      Returns an AnnotationCreator for annotation of given annotationType.

      Useful for representing nested annotations (see addValue).

      Parameters:
      annotationType - class name of the annotation to create, must not be null
      Returns:
      an AnnotationCreator, never null
    • of

      static AnnotationCreator of(Class<?> annotationType)
      Returns an AnnotationCreator for annotation of given annotationType.

      Useful for representing nested annotations (see addValue).

      Parameters:
      annotationType - type of the annotation to create, must not be null
      Returns:
      an AnnotationCreator, never null
    • of

      static AnnotationCreator of(String annotationType, RetentionPolicy retentionPolicy)
      Returns an AnnotationCreator for annotation of given annotationType which has given retentionPolicy.

      Useful for representing nested annotations (see addValue).

      Parameters:
      annotationType - class name of the annotation to create, must not be null
      retentionPolicy - retention policy of the annotation type
      Returns:
      an AnnotationCreator, never null
    • add

      default AnnotationCreator add(String name, Object value)
      Same as addValue(String, Object), but returns this to allow fluent usage.
    • addValue

      void addValue(String name, Object value)
      Add a new annotation element with the given name and value. The name may be any permissible annotation element name (for example, toString or annotationType are invalid). The value may be:
      • primitive wrapper type
      • String
      • Enum
      • Class
      • nested annotation as an AnnotationCreator created using AnnotationCreator.of(), or as a Jandex AnnotationInstance
      • array of previously mentioned types
      In addition to the types listed above, the value may also be a Jandex AnnotationValue.
      Parameters:
      name - name of the annotation element to add
      value - value of the annotation element to add