Interface AnnotationElement
- All Superinterfaces:
ClassFileElementPREVIEW
,WritableElementPREVIEW<AnnotationElementPREVIEW>
AnnotationElement
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a key-value pair of an annotation.
- Since:
- 22
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionname()
Returns the element name.static AnnotationElementPREVIEW
of
(Utf8EntryPREVIEW name, AnnotationValuePREVIEW value) Returns an annotation key-value pair.static AnnotationElementPREVIEW
of
(String name, AnnotationValuePREVIEW value) Returns an annotation key-value pair.static AnnotationElementPREVIEW
ofAnnotation
(String name, AnnotationPREVIEW value) Returns an annotation key-value pair for an annotation-valued annotation.static AnnotationElementPREVIEW
ofArray
(String name, AnnotationValuePREVIEW... values) Returns an annotation key-value pair for an array-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a boolean-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a byte-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a char-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a class-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a double-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a float-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for an int-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a long-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a short-valued annotation.static AnnotationElementPREVIEW
Returns an annotation key-value pair for a string-valued annotation.value()
Returns the element value.Methods declared in interface java.lang.classfile.WritableElementPREVIEW
writeTo
-
Method Details
-
name
-
value
-
of
Returns an annotation key-value pair.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair
-
of
Returns an annotation key-value pair.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair
-
ofClass
Returns an annotation key-value pair for a class-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a class-valued annotation
-
ofString
Returns an annotation key-value pair for a string-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a string-valued annotation
-
ofLong
Returns an annotation key-value pair for a long-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a long-valued annotation
-
ofInt
Returns an annotation key-value pair for an int-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for an int-valued annotation
-
ofChar
Returns an annotation key-value pair for a char-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a char-valued annotation
-
ofShort
Returns an annotation key-value pair for a short-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a short-valued annotation
-
ofByte
Returns an annotation key-value pair for a byte-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a byte-valued annotation
-
ofBoolean
Returns an annotation key-value pair for a boolean-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a boolean-valued annotation
-
ofDouble
Returns an annotation key-value pair for a double-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a double-valued annotation
-
ofFloat
Returns an annotation key-value pair for a float-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for a float-valued annotation
-
ofAnnotation
Returns an annotation key-value pair for an annotation-valued annotation.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an annotation key-value pair for an annotation-valued annotation
-
ofArray
Returns an annotation key-value pair for an array-valued annotation.- Parameters:
name
- the name of the keyvalues
- the associated values- Returns:
- an annotation key-value pair for an array-valued annotation
-
AnnotationElement
when preview features are enabled.