Package Summary Overview Summary

Module java.base
Package java.lang.classfilePREVIEW

# Interface AnnotationValue

All Superinterfaces:
  `ClassFileElementPREVIEW`, `WritableElementPREVIEW<AnnotationValuePREVIEW>`

All Known Subinterfaces:
  `AnnotationValue.OfAnnotationPREVIEW`, `AnnotationValue.OfArrayPREVIEW`, `AnnotationValue.OfBooleanPREVIEW`, `AnnotationValue.OfBytePREVIEW`, `AnnotationValue.OfCharacterPREVIEW`, `AnnotationValue.OfClassPREVIEW`, `AnnotationValue.OfConstantPREVIEW`, `AnnotationValue.OfDoublePREVIEW`, `AnnotationValue.OfEnumPREVIEW`, `AnnotationValue.OfFloatPREVIEW`, `AnnotationValue.OfIntegerPREVIEW`, `AnnotationValue.OfLongPREVIEW`, `AnnotationValue.OfShortPREVIEW`, `AnnotationValue.OfStringPREVIEW`

public sealed interface AnnotationValue extends WritableElementPREVIEW<AnnotationValuePREVIEW> permits AnnotationValue.OfAnnotationPREVIEW, AnnotationValue.OfArrayPREVIEW, AnnotationValue.OfConstantPREVIEW, AnnotationValue.OfClassPREVIEW, AnnotationValue.OfEnumPREVIEW
`AnnotationValue` is a preview API of the Java platform.
Programs can only use `AnnotationValue` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the value of a key-value pair of an annotation.

Sealed Class Hierarchy Graph:
Since:
  22
See Also:
  - `Annotation`PREVIEW
  - `AnnotationElement`PREVIEW

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `AnnotationValue.OfAnnotationPREVIEW`
  Preview.
  Models an annotation-valued element
  `static interface`
  `AnnotationValue.OfArrayPREVIEW`
  Preview.
  Models an array-valued element
  `static interface`
  `AnnotationValue.OfBooleanPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfBytePREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfCharacterPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfClassPREVIEW`
  Preview.
  Models a class-valued element
  `static interface`
  `AnnotationValue.OfConstantPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfDoublePREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfEnumPREVIEW`
  Preview.
  Models an enum-valued element
  `static interface`
  `AnnotationValue.OfFloatPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfIntegerPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfLongPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfShortPREVIEW`
  Preview.
  Models a constant-valued element
  `static interface`
  `AnnotationValue.OfStringPREVIEW`
  Preview.
  Models a constant-valued element

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static AnnotationValuePREVIEW`
  `of (Object value)`
  Returns an annotation element.
  `static AnnotationValue.OfAnnotationPREVIEW`
  `ofAnnotation (AnnotationPREVIEW value)`
  Returns an annotation element for an annotation-valued element.
  `static AnnotationValue.OfArrayPREVIEW`
  `ofArray (AnnotationValuePREVIEW... values)`
  Returns an annotation element for an array-valued element.
  `static AnnotationValue.OfArrayPREVIEW`
  `ofArray (List<AnnotationValuePREVIEW> values)`
  Returns an annotation element for an array-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofBoolean (boolean value)`
  Returns an annotation element for a boolean-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofBoolean (IntegerEntryPREVIEW value)`
  Returns an annotation element for a boolean-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofByte (byte value)`
  Returns an annotation element for a byte-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofByte (IntegerEntryPREVIEW value)`
  Returns an annotation element for a byte-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofChar (char value)`
  Returns an annotation element for a char-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofChar (IntegerEntryPREVIEW value)`
  Returns an annotation element for a char-valued element.
  `static AnnotationValue.OfClassPREVIEW`
  `ofClass (Utf8EntryPREVIEW className)`
  Returns an annotation element for a class-valued element.
  `static AnnotationValue.OfClassPREVIEW`
  `ofClass (ClassDesc className)`
  Returns an annotation element for a class-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofDouble (double value)`
  Returns an annotation element for a double-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofDouble (DoubleEntryPREVIEW value)`
  Returns an annotation element for a double-valued element.
  `static AnnotationValue.OfEnumPREVIEW`
  `ofEnum (Utf8EntryPREVIEW className, Utf8EntryPREVIEW constantName)`
  Returns an annotation element for a enum-valued element.
  `static AnnotationValue.OfEnumPREVIEW`
  `ofEnum (ClassDesc className, String constantName)`
  Returns an annotation element for a enum-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofFloat (float value)`
  Returns an annotation element for a float-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofFloat (FloatEntryPREVIEW value)`
  Returns an annotation element for a float-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofInt (int value)`
  Returns an annotation element for an int-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofInt (IntegerEntryPREVIEW value)`
  Returns an annotation element for an int-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofLong (long value)`
  Returns an annotation element for a long-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofLong (LongEntryPREVIEW value)`
  Returns an annotation element for a long-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofShort (short value)`
  Returns an annotation element for a short-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofShort (IntegerEntryPREVIEW value)`
  Returns an annotation element for a short-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofString (Utf8EntryPREVIEW value)`
  Returns an annotation element for a string-valued element.
  `static AnnotationValue.OfConstantPREVIEW`
  `ofString (String value)`
  Returns an annotation element for a string-valued element.
  `char`
  `tag()`
  Returns the tag character for this type as per 4.7.16.1.

  ### Methods declared in interface java.lang.classfile.WritableElementPREVIEW

  `writeTo`

- ## Method Details

  - ### tag

    char tag()
    Returns the tag character for this type as per 4.7.16.1.
    Returns:
      the tag character for this type as per 4.7.16.1

  - ### ofEnum

    static AnnotationValue.OfEnumPREVIEW ofEnum (Utf8EntryPREVIEW className, Utf8EntryPREVIEW constantName)
    Returns an annotation element for a enum-valued element.
    Parameters:
      `className` - the name of the enum class
      `constantName` - the name of the enum constant
    Returns:
      an annotation element for a enum-valued element

  - ### ofEnum

    static AnnotationValue.OfEnumPREVIEW ofEnum (ClassDesc className, String constantName)
    Returns an annotation element for a enum-valued element.
    Parameters:
      `className` - the name of the enum class
      `constantName` - the name of the enum constant
    Returns:
      an annotation element for a enum-valued element

  - ### ofClass

    static AnnotationValue.OfClassPREVIEW ofClass (Utf8EntryPREVIEW className)
    Returns an annotation element for a class-valued element.
    Parameters:
      `className` - the name of the enum class
    Returns:
      an annotation element for a class-valued element

  - ### ofClass

    static AnnotationValue.OfClassPREVIEW ofClass (ClassDesc className)
    Returns an annotation element for a class-valued element.
    Parameters:
      `className` - the name of the enum class
    Returns:
      an annotation element for a class-valued element

  - ### ofString

    static AnnotationValue.OfConstantPREVIEW ofString (Utf8EntryPREVIEW value)
    Returns an annotation element for a string-valued element.
    Parameters:
      `value` - the string
    Returns:
      an annotation element for a string-valued element

  - ### ofString

    static AnnotationValue.OfConstantPREVIEW ofString (String value)
    Returns an annotation element for a string-valued element.
    Parameters:
      `value` - the string
    Returns:
      an annotation element for a string-valued element

  - ### ofDouble

    static AnnotationValue.OfConstantPREVIEW ofDouble (DoubleEntryPREVIEW value)
    Returns an annotation element for a double-valued element.
    Parameters:
      `value` - the double value
    Returns:
      an annotation element for a double-valued element

  - ### ofDouble

    static AnnotationValue.OfConstantPREVIEW ofDouble (double value)
    Returns an annotation element for a double-valued element.
    Parameters:
      `value` - the double value
    Returns:
      an annotation element for a double-valued element

  - ### ofFloat

    static AnnotationValue.OfConstantPREVIEW ofFloat (FloatEntryPREVIEW value)
    Returns an annotation element for a float-valued element.
    Parameters:
      `value` - the float value
    Returns:
      an annotation element for a float-valued element

  - ### ofFloat

    static AnnotationValue.OfConstantPREVIEW ofFloat (float value)
    Returns an annotation element for a float-valued element.
    Parameters:
      `value` - the float value
    Returns:
      an annotation element for a float-valued element

  - ### ofLong

    static AnnotationValue.OfConstantPREVIEW ofLong (LongEntryPREVIEW value)
    Returns an annotation element for a long-valued element.
    Parameters:
      `value` - the long value
    Returns:
      an annotation element for a long-valued element

  - ### ofLong

    static AnnotationValue.OfConstantPREVIEW ofLong (long value)
    Returns an annotation element for a long-valued element.
    Parameters:
      `value` - the long value
    Returns:
      an annotation element for a long-valued element

  - ### ofInt

    static AnnotationValue.OfConstantPREVIEW ofInt (IntegerEntryPREVIEW value)
    Returns an annotation element for an int-valued element.
    Parameters:
      `value` - the int value
    Returns:
      an annotation element for an int-valued element

  - ### ofInt

    static AnnotationValue.OfConstantPREVIEW ofInt (int value)
    Returns an annotation element for an int-valued element.
    Parameters:
      `value` - the int value
    Returns:
      an annotation element for an int-valued element

  - ### ofShort

    static AnnotationValue.OfConstantPREVIEW ofShort (IntegerEntryPREVIEW value)
    Returns an annotation element for a short-valued element.
    Parameters:
      `value` - the short value
    Returns:
      an annotation element for a short-valued element

  - ### ofShort

    static AnnotationValue.OfConstantPREVIEW ofShort (short value)
    Returns an annotation element for a short-valued element.
    Parameters:
      `value` - the short value
    Returns:
      an annotation element for a short-valued element

  - ### ofChar

    static AnnotationValue.OfConstantPREVIEW ofChar (IntegerEntryPREVIEW value)
    Returns an annotation element for a char-valued element.
    Parameters:
      `value` - the char value
    Returns:
      an annotation element for a char-valued element

  - ### ofChar

    static AnnotationValue.OfConstantPREVIEW ofChar (char value)
    Returns an annotation element for a char-valued element.
    Parameters:
      `value` - the char value
    Returns:
      an annotation element for a char-valued element

  - ### ofByte

    static AnnotationValue.OfConstantPREVIEW ofByte (IntegerEntryPREVIEW value)
    Returns an annotation element for a byte-valued element.
    Parameters:
      `value` - the byte value
    Returns:
      an annotation element for a byte-valued element

  - ### ofByte

    static AnnotationValue.OfConstantPREVIEW ofByte (byte value)
    Returns an annotation element for a byte-valued element.
    Parameters:
      `value` - the byte value
    Returns:
      an annotation element for a byte-valued element

  - ### ofBoolean

    static AnnotationValue.OfConstantPREVIEW ofBoolean (IntegerEntryPREVIEW value)
    Returns an annotation element for a boolean-valued element.
    Parameters:
      `value` - the boolean value
    Returns:
      an annotation element for a boolean-valued element

  - ### ofBoolean

    static AnnotationValue.OfConstantPREVIEW ofBoolean (boolean value)
    Returns an annotation element for a boolean-valued element.
    Parameters:
      `value` - the boolean value
    Returns:
      an annotation element for a boolean-valued element

  - ### ofAnnotation

    static AnnotationValue.OfAnnotationPREVIEW ofAnnotation (AnnotationPREVIEW value)
    Returns an annotation element for an annotation-valued element.
    Parameters:
      `value` - the annotation
    Returns:
      an annotation element for an annotation-valued element

  - ### ofArray

    static AnnotationValue.OfArrayPREVIEW ofArray (List<AnnotationValuePREVIEW> values)
    Returns an annotation element for an array-valued element.
    Parameters:
      `values` - the values
    Returns:
      an annotation element for an array-valued element

  - ### ofArray

    static AnnotationValue.OfArrayPREVIEW ofArray (AnnotationValuePREVIEW... values)
    Returns an annotation element for an array-valued element.
    Parameters:
      `values` - the values
    Returns:
      an annotation element for an array-valued element

  - ### of

    static AnnotationValuePREVIEW of (Object value)
    Returns an annotation element. The `value` parameter must be a primitive, a wrapper of primitive, a String, a ClassDesc, an enum constant, or an array of one of these.
    Parameters:
      `value` - the annotation value
    Returns:
      an annotation element
    Throws:
      `IllegalArgumentException` - when the `value` parameter is not a primitive, a wrapper of primitive, a String, a ClassDesc, an enum constant, or an array of one of these.