Interface AnnotationElement


public sealed interface AnnotationElement
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:
24
See Also:
  • Method Details

    • name

      Utf8Entry name()
      Returns the element name.
      API Note:
      In Java source code, by convention, the name of the sole element in a single-element annotation interface is value. (JLS 9.6.1) This is the case for single-element annotations (JLS 9.7.3) and container annotations for multiple annotations (JLS 9.6.3).
      Returns:
      the element name
    • value

      Returns the element value.
      Returns:
      the element value
    • of

      static AnnotationElement of(Utf8Entry name, AnnotationValue value)
      Returns an element-value pair.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair
    • of

      static AnnotationElement of(String name, AnnotationValue value)
      Returns an element-value pair.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair
    • ofClass

      static AnnotationElement ofClass(String name, ClassDesc value)
      Returns an element-value pair for a class-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a class-valued element
      See Also:
    • ofString

      static AnnotationElement ofString(String name, String value)
      Returns an element-value pair for a string-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a string-valued element
      See Also:
    • ofLong

      static AnnotationElement ofLong(String name, long value)
      Returns an element-value pair for a long-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a long-valued element
      See Also:
    • ofInt

      static AnnotationElement ofInt(String name, int value)
      Returns an element-value pair for an int-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for an int-valued element
      See Also:
    • ofChar

      static AnnotationElement ofChar(String name, char value)
      Returns an element-value pair for a char-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a char-valued element
      See Also:
    • ofShort

      static AnnotationElement ofShort(String name, short value)
      Returns an element-value pair for a short-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a short-valued element
      See Also:
    • ofByte

      static AnnotationElement ofByte(String name, byte value)
      Returns an element-value pair for a byte-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a byte-valued element
      See Also:
    • ofBoolean

      static AnnotationElement ofBoolean(String name, boolean value)
      Returns an element-value pair for a boolean-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a boolean-valued element
      See Also:
    • ofDouble

      static AnnotationElement ofDouble(String name, double value)
      Returns an element-value pair for a double-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a double-valued element
      See Also:
    • ofFloat

      static AnnotationElement ofFloat(String name, float value)
      Returns an element-value pair for a float-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for a float-valued element
      See Also:
    • ofAnnotation

      static AnnotationElement ofAnnotation(String name, Annotation value)
      Returns an element-value pair for an annotation-valued element.
      Parameters:
      name - the name of the key
      value - the associated value
      Returns:
      an element-value pair for an annotation-valued element
      See Also:
    • ofArray

      static AnnotationElement ofArray(String name, AnnotationValue... values)
      Returns an element-value pair for an array-valued element.
      Parameters:
      name - the name of the key
      values - the associated values
      Returns:
      an element-value pair for an array-valued element
      See Also: