public sealed interface AnnotationElement
element_value_pairs table in the annotation structure defined in JVMS 4.7.16 or the type_annotation structure defined in JVMS 4.7.20. Two AnnotationElement objects should be compared using the equals method.
element_value structure| Modifier and Type | Method | Description |
|---|---|---|
Utf8Entry |
name() |
Returns the element name. |
static AnnotationElement |
of |
Returns an element-value pair. |
static AnnotationElement |
of |
Returns an element-value pair. |
static AnnotationElement |
ofAnnotation |
Returns an element-value pair for an annotation-valued element. |
static AnnotationElement |
ofArray |
Returns an element-value pair for an array-valued element. |
static AnnotationElement |
ofBoolean |
Returns an element-value pair for a boolean-valued element. |
static AnnotationElement |
ofByte |
Returns an element-value pair for a byte-valued element. |
static AnnotationElement |
ofChar |
Returns an element-value pair for a char-valued element. |
static AnnotationElement |
ofClass |
Returns an element-value pair for a class-valued element. |
static AnnotationElement |
ofDouble |
Returns an element-value pair for a double-valued element. |
static AnnotationElement |
ofFloat |
Returns an element-value pair for a float-valued element. |
static AnnotationElement |
ofInt |
Returns an element-value pair for an int-valued element. |
static AnnotationElement |
ofLong |
Returns an element-value pair for a long-valued element. |
static AnnotationElement |
ofShort |
Returns an element-value pair for a short-valued element. |
static AnnotationElement |
ofString |
Returns an element-value pair for a string-valued element. |
AnnotationValue |
value() |
Returns the element value. |
Utf8Entry name()
AnnotationValue value()
static AnnotationElement of(Utf8Entry name, AnnotationValue value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement of(String name, AnnotationValue value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofClass(String name, ClassDesc value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofString(String name, String value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofLong(String name, long value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofInt(String name, int value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofChar(String name, char value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofShort(String name, short value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofByte(String name, byte value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofBoolean(String name, boolean value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofDouble(String name, double value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofFloat(String name, float value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofAnnotation(String name, Annotation value)
name - the name of the keyvalue - the associated valuestatic AnnotationElement ofArray(String name, AnnotationValue... values)
name - the name of the keyvalues - the associated values
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/AnnotationElement.html