Interface Hson.Value<T>

Type Parameters:
T - type of the value
All Known Subinterfaces:
Hson.Array, Hson.Struct
Enclosing class:
Hson

public static sealed interface Hson.Value<T> permits Hson.Struct, Hson.Array (not exhaustive)
A HSON value (may of types of Hson.Type).
  • Method Summary

    Modifier and Type
    Method
    Description
    default Hson.Array
    Get this parsed value as an array.
    default Hson.Struct
    Get this parsed value as a struct.
    Type of this value.
    Value.
    void
    Write the HSON value.
    default void
    write(PrintWriter writer, boolean formatted)
    Writes the HSON in a formatted output, if enabled.
  • Method Details

    • write

      void write(PrintWriter writer)
      Write the HSON value.
      Parameters:
      writer - writer to write to
    • write

      default void write(PrintWriter writer, boolean formatted)
      Writes the HSON in a formatted output, if enabled.
      Parameters:
      writer - writer to write to
      formatted - whether the output should be formatted
    • value

      T value()
      Value.
      Returns:
      the value
    • type

      Hson.Type type()
      Type of this value.
      Returns:
      type of this value
    • asArray

      default Hson.Array asArray()
      Get this parsed value as an array.
      Returns:
      this value as an array
      Throws:
      HsonException - in case this value is not of type Hson.Type.ARRAY
    • asStruct

      default Hson.Struct asStruct()
      Get this parsed value as a struct.
      Returns:
      this value as a struct
      Throws:
      HsonException - in case this value is not of type Hson.Type.STRUCT