AnnotationValue.OfConstant (Java SE 23 & JDK 23)
Description: declaration: module: java.base, package: java.lang.classfile, interface: AnnotationValue, interface: OfConstant
Keywords: java.lang.classfile.AnnotationValue.OfConstant interface

# Interface AnnotationValue.OfConstant

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

All Known Subinterfaces:
  `AnnotationValue.OfBooleanPREVIEW`, `AnnotationValue.OfBytePREVIEW`, `AnnotationValue.OfCharacterPREVIEW`, `AnnotationValue.OfDoublePREVIEW`, `AnnotationValue.OfFloatPREVIEW`, `AnnotationValue.OfIntegerPREVIEW`, `AnnotationValue.OfLongPREVIEW`, `AnnotationValue.OfShortPREVIEW`, `AnnotationValue.OfStringPREVIEW`

Enclosing interface:
  `AnnotationValuePREVIEW`

public static sealed interface AnnotationValue.OfConstant extends AnnotationValuePREVIEW permits AnnotationValue.OfStringPREVIEW, AnnotationValue.OfDoublePREVIEW, AnnotationValue.OfFloatPREVIEW, AnnotationValue.OfLongPREVIEW, AnnotationValue.OfIntegerPREVIEW, AnnotationValue.OfShortPREVIEW, AnnotationValue.OfCharacterPREVIEW, AnnotationValue.OfBytePREVIEW, AnnotationValue.OfBooleanPREVIEW (not exhaustive)
`OfConstant` is a preview API of the Java platform.
Programs can only use `OfConstant` 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 constant-valued element

Sealed Class Hierarchy Graph:
Since:
  22

- ## Nested Class Summary

  ### Nested classes/interfaces declared in interface java.lang.classfile.AnnotationValuePREVIEW

  `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`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AnnotationConstantValueEntryPREVIEW`
  `constant()`
  Returns the constant.
  `ConstantDesc`
  `constantValue()`
  Returns the constant.

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

  `tag`

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

  `writeTo`

- ## Method Details

  - ### constant

    AnnotationConstantValueEntryPREVIEW constant()
    Returns the constant.
    Returns:
      the constant

  - ### constantValue

    ConstantDesc constantValue()
    Returns the constant.
    Returns:
      the constant