Interface AnnotationElement

All Superinterfaces:
ClassFileElement, WritableElement<AnnotationElement>
All Known Implementing Classes:
AnnotationImpl.AnnotationElementImpl

public sealed interface AnnotationElement extends WritableElement<AnnotationElement> permits AnnotationImpl.AnnotationElementImpl
Models a key-value pair of an annotation.
Since:
22
See Also:
  • Method Details

    • name

      Utf8Entry name()
      Returns the element name.
      Returns:
      the element name
    • value

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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