Interface AnnotationCreator

    • Method Detail

      • of

        static AnnotationCreator of​(java.lang.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​(java.lang.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​(java.lang.String annotationType,
                                    java.lang.annotation.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
      • addValue

        void addValue​(java.lang.String name,
                      java.lang.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