Interface AnnotationElement
public sealed interface AnnotationElement
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 an element-value pair in the
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.
- Since:
- 22
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionname()
Returns the element name.static AnnotationElementPREVIEW
of
(Utf8EntryPREVIEW name, AnnotationValuePREVIEW value) Returns an element-value pair.static AnnotationElementPREVIEW
of
(String name, AnnotationValuePREVIEW value) Returns an element-value pair.static AnnotationElementPREVIEW
ofAnnotation
(String name, AnnotationPREVIEW value) Returns an element-value pair for an annotation-valued element.static AnnotationElementPREVIEW
ofArray
(String name, AnnotationValuePREVIEW... values) Returns an element-value pair for an array-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a boolean-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a byte-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a char-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a class-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a double-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a float-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for an int-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a long-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a short-valued element.static AnnotationElementPREVIEW
Returns an element-value pair for a string-valued element.value()
Returns the element value.
-
Method Details
-
name
Returns the element name. -
value
-
of
Returns an element-value pair.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair
-
of
Returns an element-value pair.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair
-
ofClass
Returns an element-value pair for a class-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a class-valued element
- See Also:
-
ofString
Returns an element-value pair for a string-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a string-valued element
- See Also:
-
ofLong
Returns an element-value pair for a long-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a long-valued element
- See Also:
-
ofInt
Returns an element-value pair for an int-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for an int-valued element
- See Also:
-
ofChar
Returns an element-value pair for a char-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a char-valued element
- See Also:
-
ofShort
Returns an element-value pair for a short-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a short-valued element
- See Also:
-
ofByte
Returns an element-value pair for a byte-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a byte-valued element
- See Also:
-
ofBoolean
Returns an element-value pair for a boolean-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a boolean-valued element
- See Also:
-
ofDouble
Returns an element-value pair for a double-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a double-valued element
- See Also:
-
ofFloat
Returns an element-value pair for a float-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for a float-valued element
- See Also:
-
ofAnnotation
Returns an element-value pair for an annotation-valued element.- Parameters:
name
- the name of the keyvalue
- the associated value- Returns:
- an element-value pair for an annotation-valued element
- See Also:
-
ofArray
Returns an element-value pair for an array-valued element.- Parameters:
name
- the name of the keyvalues
- the associated values- Returns:
- an element-value pair for an array-valued element
- See Also:
-
AnnotationElement
when preview features are enabled.