Interface ConfigurationElement<T extends AnnotatedElement>

Type Parameters:
T - the type of the element

public sealed interface ConfigurationElement<T extends AnnotatedElement>
Represents an element of a serializable configuration type. The element can either be a Field for configuration classes or a RecordComponent for records.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the annotated type of the element.
    default <A extends Annotation>
    A
    annotation(Class<A> annotationType)
    Returns the annotation of the given type or null if the element is not annotated with such an annotation.
    Returns the configuration type that defines this element.
    Returns the element itself.
    Returns the name of the element.
    Returns the type of the element.
    value(Object elementHolder)
    Given an instance of the configuration type which defines this element, returns the value the element is holding.
  • Method Details

    • element

      T element()
      Returns the element itself.
      Returns:
      the element
    • name

      String name()
      Returns the name of the element.
      Returns:
      name of the element
    • type

      Class<?> type()
      Returns the type of the element.
      Returns:
      type of the element
    • annotatedType

      AnnotatedType annotatedType()
      Returns the annotated type of the element.
      Returns:
      annotated type of element
    • value

      Object value(Object elementHolder)
      Given an instance of the configuration type which defines this element, returns the value the element is holding.
      Parameters:
      elementHolder - an instance of the configuration type that defines this element
      Returns:
      value the element is holding
      Throws:
      IllegalArgumentException - if elementHolder is not an instance of the configuration type which defines this element
    • declaringType

      Class<?> declaringType()
      Returns the configuration type that defines this element.
      Returns:
      the configuration type that defines this element
    • annotation

      default <A extends Annotation> A annotation(Class<A> annotationType)
      Returns the annotation of the given type or null if the element is not annotated with such an annotation.
      Type Parameters:
      A - the type of annotation
      Parameters:
      annotationType - the type of annotation
      Returns:
      the annotation or null
      Throws:
      NullPointerException - if annotationType is null