Interface Hson.Array

All Superinterfaces:
Hson.Value<List<Hson.Value<?>>>
Enclosing class:
Hson

public static sealed interface Hson.Array extends Hson.Value<List<Hson.Value<?>>>
A representation of HSON array. HSON array is an array of values (of any type).
  • Method Details

    • create

      static Hson.Array create()
      Create an empty JArray.
      Returns:
      empty array
    • create

      static Hson.Array create(List<? extends Hson.Value<?>> values)
      Create a new array of HSON values.
      Parameters:
      values - list of values
      Returns:
      a new array
    • createStrings

      static Hson.Array createStrings(List<String> strings)
      Create a new array of Strings.
      Parameters:
      strings - String list
      Returns:
      a new string array
    • createNumbers

      static Hson.Array createNumbers(List<BigDecimal> numbers)
      Create a new array of Numbers.
      Parameters:
      numbers - BigDecimal list
      Returns:
      a new number array
    • createBooleans

      static Hson.Array createBooleans(List<Boolean> booleans)
      Create a new array of booleans.
      Parameters:
      booleans - boolean list
      Returns:
      a new boolean array
    • create

      static Hson.Array create(long... values)
      Create a new array of Numbers from long values.
      Parameters:
      values - long numbers
      Returns:
      a new number array
    • create

      static Hson.Array create(int... values)
      Create a new array of Numbers from int values.
      Parameters:
      values - int numbers
      Returns:
      a new number array
    • create

      static Hson.Array create(double... values)
      Create a new array of Numbers from double values.
      Parameters:
      values - double numbers
      Returns:
      a new number array
    • create

      static Hson.Array create(float... values)
      Create a new array of Numbers from float values.
      Parameters:
      values - float numbers
      Returns:
      a new number array
    • getStrings

      List<String> getStrings()
      Assume this is an array of strings, and return the list.
      Returns:
      all string values of this array, except for nulls
      Throws:
      HsonException - in case not all elements of this array are strings (or nulls)
    • getBooleans

      List<Boolean> getBooleans()
      Assume this is an array of booleans, and return the list.
      Returns:
      all boolean values of this array, except for nulls
      Throws:
      HsonException - in case not all elements of this array are booleans (or nulls)
    • getNumbers

      List<BigDecimal> getNumbers()
      Assume this is an array of numbers, and return the list.
      Returns:
      all big decimal values of this array, except for nulls
      Throws:
      HsonException - in case not all elements of this array are numbers (or nulls)
    • getStructs

      List<Hson.Struct> getStructs()
      Assume this is an array of structs, and return the list.
      Returns:
      all struct values of this array, except for nulls
      Throws:
      HsonException - in case not all elements of this array are structs (or nulls)