Package org.tomlj

Interface TomlArray

All Known Implementing Classes:
EmptyTomlArray, MutableHomogeneousTomlArray, MutableTomlArray

@DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class, locations={RETURN,PARAMETER,FIELD}) public interface TomlArray
An array of TOML values.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    boolean
    Deprecated.
    Future releases will support heterogeneous arrays and this method will be removed.
    get(int index)
    Get a value at a specified index.
    default TomlArray
    getArray(int index)
    Get an array at a specified index.
    default boolean
    getBoolean(int index)
    Get a boolean at a specified index.
    default double
    getDouble(int index)
    Get a double at a specified index.
    default LocalDate
    getLocalDate(int index)
    Get a local date at a specified index.
    getLocalDateTime(int index)
    Get a local date time at a specified index.
    default LocalTime
    getLocalTime(int index)
    Get a local time at a specified index.
    default long
    getLong(int index)
    Get a long at a specified index.
    getOffsetDateTime(int index)
    Get an offset date time at a specified index.
    default String
    getString(int index)
    Get a string at a specified index.
    default TomlTable
    getTable(int index)
    Get a table at a specified index.
    inputPositionOf(int index)
    Get the position where a value is defined in the TOML document.
    boolean
    true if the array is empty.
    int
    The size of the array.
    default void
    toJson(Appendable appendable, EnumSet<JsonOptions> options)
    Append a JSON representation of this array to the appendable output.
    default void
    toJson(Appendable appendable, JsonOptions... options)
    Append a JSON representation of this array to the appendable output.
    default String
    Return a representation of this array using JSON.
    default String
    toJson(JsonOptions... options)
    Return a representation of this array using JSON.
    Get the elements of this array as a List.
    default String
    Return a representation of this array using TOML.
    default void
    toToml(Appendable appendable)
    Append a TOML representation of this array to the appendable output.
  • Method Details

    • size

      int size()
      The size of the array.
      Returns:
      The size of the array.
    • isEmpty

      boolean isEmpty()
      true if the array is empty.
      Returns:
      true if the array is empty.
    • containsStrings

      boolean containsStrings()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains strings.
      Returns:
      true if the array contains strings.
    • containsLongs

      boolean containsLongs()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains longs.
      Returns:
      true if the array contains longs.
    • containsDoubles

      boolean containsDoubles()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains doubles.
      Returns:
      true if the array contains doubles.
    • containsBooleans

      boolean containsBooleans()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains booleans.
      Returns:
      true if the array contains booleans.
    • containsOffsetDateTimes

      boolean containsOffsetDateTimes()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains OffsetDateTimes.
      Returns:
      true if the array contains OffsetDateTimes.
    • containsLocalDateTimes

      boolean containsLocalDateTimes()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains LocalDateTimes.
      Returns:
      true if the array contains LocalDateTimes.
    • containsLocalDates

      boolean containsLocalDates()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains LocalDates.
      Returns:
      true if the array contains LocalDates.
    • containsLocalTimes

      boolean containsLocalTimes()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains LocalTimes.
      Returns:
      true if the array contains LocalTimes.
    • containsArrays

      boolean containsArrays()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains arrays.
      Returns:
      true if the array contains arrays.
    • containsTables

      boolean containsTables()
      Deprecated.
      Future releases will support heterogeneous arrays and this method will be removed.
      true if the array contains tables.
      Returns:
      true if the array contains tables.
    • get

      Object get(int index)
      Get a value at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
    • inputPositionOf

      TomlPosition inputPositionOf(int index)
      Get the position where a value is defined in the TOML document.
      Parameters:
      index - The array index.
      Returns:
      The input position.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
    • getString

      default String getString(int index)
      Get a string at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not a long.
    • getLong

      default long getLong(int index)
      Get a long at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not a long.
    • getDouble

      default double getDouble(int index)
      Get a double at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not a long.
    • getBoolean

      default boolean getBoolean(int index)
      Get a boolean at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not a long.
    • getOffsetDateTime

      default OffsetDateTime getOffsetDateTime(int index)
      Get an offset date time at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not an OffsetDateTime.
    • getLocalDateTime

      default LocalDateTime getLocalDateTime(int index)
      Get a local date time at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not an LocalDateTime.
    • getLocalDate

      default LocalDate getLocalDate(int index)
      Get a local date at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not an LocalDate.
    • getLocalTime

      default LocalTime getLocalTime(int index)
      Get a local time at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not an LocalTime.
    • getArray

      default TomlArray getArray(int index)
      Get an array at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not an array.
    • getTable

      default TomlTable getTable(int index)
      Get a table at a specified index.
      Parameters:
      index - The array index.
      Returns:
      The value.
      Throws:
      IndexOutOfBoundsException - If the index is out of bounds.
      TomlInvalidTypeException - If the value is not a table.
    • toList

      List<Object> toList()
      Get the elements of this array as a List.

      Note that this does not do a deep conversion. If this array contains tables or arrays, they will be of type TomlTable or TomlArray respectively.

      Returns:
      The elements of this array as a List.
    • toJson

      default String toJson(JsonOptions... options)
      Return a representation of this array using JSON.
      Parameters:
      options - Options for the JSON encoder.
      Returns:
      A JSON representation of this table.
    • toJson

      default String toJson(EnumSet<JsonOptions> options)
      Return a representation of this array using JSON.
      Parameters:
      options - Options for the JSON encoder.
      Returns:
      A JSON representation of this table.
    • toJson

      default void toJson(Appendable appendable, JsonOptions... options) throws IOException
      Append a JSON representation of this array to the appendable output.
      Parameters:
      appendable - The appendable output.
      options - Options for the JSON encoder.
      Throws:
      IOException - If an IO error occurs.
    • toJson

      default void toJson(Appendable appendable, EnumSet<JsonOptions> options) throws IOException
      Append a JSON representation of this array to the appendable output.
      Parameters:
      appendable - The appendable output.
      options - Options for the JSON encoder.
      Throws:
      IOException - If an IO error occurs.
    • toToml

      default String toToml()
      Return a representation of this array using TOML.
      Returns:
      A TOML representation of this array.
    • toToml

      default void toToml(Appendable appendable) throws IOException
      Append a TOML representation of this array to the appendable output.
      Parameters:
      appendable - The appendable output.
      Throws:
      IOException - If an IO error occurs.