Interface Element

All Known Implementing Classes:
ArrayElement, NullElement, ObjectElement, PrimitiveElement

public sealed interface Element permits ArrayElement, NullElement, ObjectElement, PrimitiveElement
An abstract element that can be included into any document type. Not all implemented types must be supported by a document type. The default element types are:
  1. Objects
  2. Arrays
  3. Primitives
  4. Null
Since:
4.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Indicates that an element has no key.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Applies the given visitor to this element.
    key()
    Get the key of this element or an empty string (NO_KEY) if the element has no key.
  • Field Details

    • NO_KEY

      static final String NO_KEY
      Indicates that an element has no key. This key is only used for array entries at the moment.
      See Also:
  • Method Details

    • key

      Get the key of this element or an empty string (NO_KEY) if the element has no key.
      Returns:
      the key of this element.
    • accept

      void accept(@NonNull @NonNull ElementVisitor visitor)
      Applies the given visitor to this element. It is up to the implementation (and therefore the element type) to decide what steps should be executed on the given element visitor.
      Parameters:
      visitor - the visitor to apply to this element.
      Throws:
      NullPointerException - if the given visitor is null.