APIdia Launch Partner
Top Description Methods
java.lang.classfile.attribute

public sealed Interface AnnotationDefaultAttribute

extends Attribute<AnnotationDefaultAttribute>, MethodElement
permits BoundAnnotationDefaultAttr, UnboundAnnotationDefaultAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundAnnotationDefaultAttr, jdk.internal.classfile.impl.UnboundAttribute.UnboundAnnotationDefaultAttribute
Imports
java.lang.classfile.AnnotationValue, .Attribute, .AttributeMapper, .AttributeMapper.AttributeStability, .Attributes, .ClassFile, .MethodElement, java.lang.reflect.Method, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute

Models the AnnotationDefault attribute (JVMS 4.7.22), which records the default value (JLS 9.6.2) for the annotation interface element defined by this method.

This attribute only appears on methods, and does not permit multiple instances in a method. It has a data dependency on the constant pool.

This attribute was introduced in the Java SE Platform version 5.0, major version 49.

Since
24
Java Language Specification
9.6.2 Defaults for Annotation Interface Elements
Java Virtual Machine Specification
4.7.22 The AnnotationDefault Attribute
See Also
Attributes#annotationDefault()

Method Summary

Modifier and TypeMethod and Description
public AnnotationValue

Returns:

the default value of the annotation interface element defined by the enclosing method
defaultValue
()

Returns the default value of the annotation interface element defined by the enclosing method.

public static AnnotationDefaultAttribute

Returns:

an AnnotationDefault attribute
of
(AnnotationValue
the default value of the annotation interface element
annotationDefault
)

Returns an AnnotationDefault attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

defaultValueback to summary
public AnnotationValue defaultValue()

Returns the default value of the annotation interface element defined by the enclosing method.

Returns:AnnotationValue

the default value of the annotation interface element defined by the enclosing method

See Also
Method#getDefaultValue()
ofback to summary
public static AnnotationDefaultAttribute of(AnnotationValue annotationDefault)

Returns an AnnotationDefault attribute.

Parameters
annotationDefault:AnnotationValue

the default value of the annotation interface element

Returns:AnnotationDefaultAttribute

an AnnotationDefault attribute