Interface AnnotationElement

All Superinterfaces:
ClassFileElementPREVIEW, WritableElementPREVIEW<AnnotationElementPREVIEW>

public sealed interface AnnotationElement extends WritableElementPREVIEW<AnnotationElementPREVIEW>
AnnotationElement is a preview API of the Java platform.
Programs can only use AnnotationElement when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a key-value pair of an annotation.
Since:
22
See Also:
  • Method Details

    • name

      Returns the element name.
      Returns:
      the element name
    • value

      Returns the element value.
      Returns:
      the element value
    • of

      Returns an annotation key-value pair.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair
    • of

      Returns an annotation key-value pair.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair
    • ofClass

      static AnnotationElementPREVIEW ofClass(String name, ClassDesc value)
      Returns an annotation key-value pair for a class-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a class-valued annotation
    • ofString

      static AnnotationElementPREVIEW ofString(String name, String value)
      Returns an annotation key-value pair for a string-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a string-valued annotation
    • ofLong

      static AnnotationElementPREVIEW ofLong(String name, long value)
      Returns an annotation key-value pair for a long-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a long-valued annotation
    • ofInt

      static AnnotationElementPREVIEW ofInt(String name, int value)
      Returns an annotation key-value pair for an int-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for an int-valued annotation
    • ofChar

      static AnnotationElementPREVIEW ofChar(String name, char value)
      Returns an annotation key-value pair for a char-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a char-valued annotation
    • ofShort

      static AnnotationElementPREVIEW ofShort(String name, short value)
      Returns an annotation key-value pair for a short-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a short-valued annotation
    • ofByte

      static AnnotationElementPREVIEW ofByte(String name, byte value)
      Returns an annotation key-value pair for a byte-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a byte-valued annotation
    • ofBoolean

      static AnnotationElementPREVIEW ofBoolean(String name, boolean value)
      Returns an annotation key-value pair for a boolean-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a boolean-valued annotation
    • ofDouble

      static AnnotationElementPREVIEW ofDouble(String name, double value)
      Returns an annotation key-value pair for a double-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a double-valued annotation
    • ofFloat

      static AnnotationElementPREVIEW ofFloat(String name, float value)
      Returns an annotation key-value pair for a float-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for a float-valued annotation
    • ofAnnotation

      static AnnotationElementPREVIEW ofAnnotation(String name, AnnotationPREVIEW value)
      Returns an annotation key-value pair for an annotation-valued annotation.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an annotation key-value pair for an annotation-valued annotation
    • ofArray

      static AnnotationElementPREVIEW ofArray(String name, AnnotationValuePREVIEW... values)
      Returns an annotation key-value pair for an array-valued annotation.
      Parameters:
      name - the name of the key
      values - the associated values
      Returns:
      an annotation key-value pair for an array-valued annotation