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

# Interface AnnotationValue.OfAnnotation

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

Enclosing interface:
  `AnnotationValuePREVIEW`

public static sealed interface AnnotationValue.OfAnnotation extends AnnotationValuePREVIEW
`OfAnnotation` is a preview API of the Java platform.
Programs can only use `OfAnnotation` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models an annotation-valued element

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
  `AnnotationPREVIEW`
  `annotation()`
  Returns the annotation.

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

  `tag`

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

  `writeTo`

- ## Method Details

  - ### annotation

    AnnotationPREVIEW annotation()
    Returns the annotation.
    Returns:
      the annotation