Package Summary Overview Summary

Module java.base
Package java.lang.classfile.attributePREVIEW

# Interface AnnotationDefaultAttribute

All Superinterfaces:
  `AttributePREVIEW<AnnotationDefaultAttributePREVIEW>`, `ClassFileElementPREVIEW`, `MethodElementPREVIEW`, `WritableElementPREVIEW<AnnotationDefaultAttributePREVIEW>`

public sealed interface AnnotationDefaultAttribute extends AttributePREVIEW<AnnotationDefaultAttributePREVIEW>, MethodElementPREVIEW
`AnnotationDefaultAttribute` is a preview API of the Java platform.
Programs can only use `AnnotationDefaultAttribute` 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 `AnnotationDefault` attribute 4.7.22, which can appear on methods of annotation types, and records the default value 9.6.2 for the element corresponding to this method. Delivered as a `MethodElement`PREVIEW when traversing the elements of a `MethodModel`PREVIEW.

The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.

The attribute was introduced in the Java SE Platform version 5.0.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AnnotationValuePREVIEW`
  `defaultValue()`
  Returns the default value of the annotation type element represented by this method.
  `static AnnotationDefaultAttributePREVIEW`
  `of (AnnotationValuePREVIEW annotationDefault)`
  Returns an `AnnotationDefault` attribute.

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

  `attributeMapper, attributeName`

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

  `writeTo`

- ## Method Details

  - ### defaultValue

    AnnotationValuePREVIEW defaultValue()
    Returns the default value of the annotation type element represented by this method.
    Returns:
      the default value of the annotation type element represented by this method

  - ### of

    static AnnotationDefaultAttributePREVIEW of (AnnotationValuePREVIEW annotationDefault)
    Returns an `AnnotationDefault` attribute.
    Parameters:
      `annotationDefault` - the default value of the annotation type element
    Returns:
      an `AnnotationDefault` attribute