Package org.tomlj

Interface TomlTable

All Known Subinterfaces:
TomlParseResult
All Known Implementing Classes:
EmptyTomlTable, MutableTomlTable

@DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class, locations={RETURN,PARAMETER,FIELD}) public interface TomlTable
An interface for accessing data stored in Tom's Obvious, Minimal Language (TOML).
  • Method Details

    • size

      int size()
      Return the number of entries in tis table.
      Returns:
      The number of entries in tis table.
    • isEmpty

      boolean isEmpty()
      true if there are no entries in this table.
      Returns:
      true if there are no entries in this table.
    • contains

      default boolean contains(String dottedKey)
      Check if a key was set in the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.port").
      Returns:
      true if the key was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • contains

      default boolean contains(List<String> path)
      Check if a key was set in the TOML document.
      Parameters:
      path - The key path.
      Returns:
      true if the key was set in the TOML document.
    • keySet

      Set<String> keySet()
      Get the keys of this table.

      The returned set contains only immediate keys to this table, and not dotted keys or key paths. For a complete view of keys available in the TOML document, use dottedKeySet() or keyPathSet().

      Returns:
      A set containing the keys of this table.
    • dottedKeySet

      default Set<String> dottedKeySet()
      Get all the dotted keys of this table.

      Paths to intermediary and empty tables are not returned. To include these, use dottedKeySet(boolean).

      Returns:
      A set containing all the dotted keys of this table.
    • dottedKeySet

      default Set<String> dottedKeySet(boolean includeTables)
      Get all the dotted keys of this table.
      Parameters:
      includeTables - If true, also include paths to intermediary and empty tables.
      Returns:
      A set containing all the dotted keys of this table.
    • keyPathSet

      default Set<List<String>> keyPathSet()
      Get all the paths in this table.

      Paths to intermediary and empty tables are not returned. To include these, use keyPathSet(boolean).

      Returns:
      A set containing all the key paths of this table.
    • keyPathSet

      Set<List<String>> keyPathSet(boolean includeTables)
      Get all the paths in this table.
      Parameters:
      includeTables - If true, also include paths to intermediary and empty tables.
      Returns:
      A set containing all the key paths of this table.
    • entrySet

      Set<Map.Entry<String,Object>> entrySet()
      Get the entries of this table.

      The returned set contains only immediate entries of this table, and not entries with dotted keys or key paths. For a complete view of all entries available in the TOML document, use dottedEntrySet() or entryPathSet().

      Returns:
      A set containing the immediate entries of this table.
    • dottedEntrySet

      default Set<Map.Entry<String,Object>> dottedEntrySet()
      Get all the dotted entries of this table.

      Paths to intermediary and empty tables are not returned. To include these, use dottedEntrySet(boolean).

      Returns:
      A set containing all the entries of this table.
    • dottedEntrySet

      default Set<Map.Entry<String,Object>> dottedEntrySet(boolean includeTables)
      Get all the dotted entries of this table.
      Parameters:
      includeTables - If true, also include paths to intermediary and empty tables.
      Returns:
      A set containing all the entries of this table.
    • entryPathSet

      default Set<Map.Entry<List<String>,Object>> entryPathSet()
      Get all the entries in this table.

      Paths to intermediary and empty tables are not returned. To include these, use entryPathSet(boolean).

      Returns:
      A set containing all the entries of this table.
    • entryPathSet

      Set<Map.Entry<List<String>,Object>> entryPathSet(boolean includeTables)
      Get all the entries in this table.
      Parameters:
      includeTables - If true, also include entries in intermediary and empty tables.
      Returns:
      A set containing all the entries of this table.
    • get

      default @Nullable Object get(String dottedKey)
      Get a value from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If any element of the path preceding the final key is not a table.
    • get

      @Nullable Object get(List<String> path)
      Get a value from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If any element of the path preceding the final key is not a table.
    • inputPositionOf

      default @Nullable TomlPosition inputPositionOf(String dottedKey)
      Get the position where a key is defined in the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The input position, or null if the key was not set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If any element of the path preceding the final key is not a table.
    • inputPositionOf

      @Nullable TomlPosition inputPositionOf(List<String> path)
      Get the position where a key is defined in the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The input position, or null if the key was not set in the TOML document.
      Throws:
      TomlInvalidTypeException - If any element of the path preceding the final key is not a table.
    • isString

      default boolean isString(String dottedKey)
      Check if a value in the TOML document is a string.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.hostname").
      Returns:
      true if the value can be obtained as a string.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isString

      default boolean isString(List<String> path)
      Check if a value in the TOML document is a string.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a string.
    • getString

      default @Nullable String getString(String dottedKey)
      Get a string from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.hostname").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a string, or any element of the path preceding the final key is not a table.
    • getString

      default @Nullable String getString(List<String> path)
      Get a string from the TOML document.
      Parameters:
      path - A dotted key (e.g. "server.address.hostname").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a string, or any element of the path preceding the final key is not a table.
    • getString

      default String getString(String dottedKey, Supplier<String> defaultValue)
      Get a string from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.hostname").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a string, or any element of the path preceding the final key is not a table.
    • getString

      default String getString(List<String> path, Supplier<String> defaultValue)
      Get a string from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a string, or any element of the path preceding the final key is not a table.
    • isLong

      default boolean isLong(String dottedKey)
      Check if a value in the TOML document is a long.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as a long.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isLong

      default boolean isLong(List<String> path)
      Check if a value in the TOML document is a long.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a long.
    • getLong

      default @Nullable Long getLong(String dottedKey)
      Get a long from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a long, or any element of the path preceding the final key is not a table.
    • getLong

      default @Nullable Long getLong(List<String> path)
      Get a long from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a long, or any element of the path preceding the final key is not a table.
    • getLong

      default long getLong(String dottedKey, LongSupplier defaultValue)
      Get a long from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a long, or any element of the path preceding the final key is not a table.
    • getLong

      default long getLong(List<String> path, LongSupplier defaultValue)
      Get a long from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a long, or any element of the path preceding the final key is not a table.
    • isDouble

      default boolean isDouble(String dottedKey)
      Check if a value in the TOML document is a double.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as a double.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isDouble

      default boolean isDouble(List<String> path)
      Check if a value in the TOML document is a double.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a double.
    • getDouble

      default @Nullable Double getDouble(String dottedKey)
      Get a double from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a double, or any element of the path preceding the final key is not a table.
    • getDouble

      default @Nullable Double getDouble(List<String> path)
      Get a double from the TOML document.
      Parameters:
      path - A dotted key.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a double, or any element of the path preceding the final key is not a table.
    • getDouble

      default double getDouble(String dottedKey, DoubleSupplier defaultValue)
      Get a double from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a double, or any element of the path preceding the final key is not a table.
    • getDouble

      default double getDouble(List<String> path, DoubleSupplier defaultValue)
      Get a double from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a double, or any element of the path preceding the final key is not a table.
    • isBoolean

      default boolean isBoolean(String dottedKey)
      Check if a value in the TOML document is a boolean.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as a boolean.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isBoolean

      default boolean isBoolean(List<String> path)
      Check if a value in the TOML document is a boolean.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a boolean.
    • getBoolean

      default @Nullable Boolean getBoolean(String dottedKey)
      Get a boolean from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a boolean, or any element of the path preceding the final key is not a table.
    • getBoolean

      default @Nullable Boolean getBoolean(List<String> path)
      Get a boolean from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a boolean, or any element of the path preceding the final key is not a table.
    • getBoolean

      default boolean getBoolean(String dottedKey, BooleanSupplier defaultValue)
      Get a boolean from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a boolean, or any element of the path preceding the final key is not a table.
    • getBoolean

      default boolean getBoolean(List<String> path, BooleanSupplier defaultValue)
      Get a boolean from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a boolean, or any element of the path preceding the final key is not a table.
    • isOffsetDateTime

      default boolean isOffsetDateTime(String dottedKey)
      Check if a value in the TOML document is an OffsetDateTime.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as an OffsetDateTime.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isOffsetDateTime

      default boolean isOffsetDateTime(List<String> path)
      Check if a value in the TOML document is an OffsetDateTime.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as an OffsetDateTime.
    • getOffsetDateTime

      default @Nullable OffsetDateTime getOffsetDateTime(String dottedKey)
      Get an offset date time from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not an OffsetDateTime, or any element of the path preceding the final key is not a table.
    • getOffsetDateTime

      default @Nullable OffsetDateTime getOffsetDateTime(List<String> path)
      Get an offset date time from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not an OffsetDateTime, or any element of the path preceding the final key is not a table.
    • getOffsetDateTime

      default OffsetDateTime getOffsetDateTime(String dottedKey, Supplier<OffsetDateTime> defaultValue)
      Get an offset date time from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not an OffsetDateTime, or any element of the path preceding the final key is not a table.
    • getOffsetDateTime

      default OffsetDateTime getOffsetDateTime(List<String> path, Supplier<OffsetDateTime> defaultValue)
      Get an offset date time from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not an OffsetDateTime, or any element of the path preceding the final key is not a table.
    • isLocalDateTime

      default boolean isLocalDateTime(String dottedKey)
      Check if a value in the TOML document is a LocalDateTime.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as a LocalDateTime.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isLocalDateTime

      default boolean isLocalDateTime(List<String> path)
      Check if a value in the TOML document is a LocalDateTime.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a LocalDateTime.
    • getLocalDateTime

      default @Nullable LocalDateTime getLocalDateTime(String dottedKey)
      Get a local date time from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a LocalDateTime, or any element of the path preceding the final key is not a table.
    • getLocalDateTime

      default @Nullable LocalDateTime getLocalDateTime(List<String> path)
      Get a local date time from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a LocalDateTime, or any element of the path preceding the final key is not a table.
    • getLocalDateTime

      default LocalDateTime getLocalDateTime(String dottedKey, Supplier<LocalDateTime> defaultValue)
      Get a local date time from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a LocalDateTime, or any element of the path preceding the final key is not a table.
    • getLocalDateTime

      default LocalDateTime getLocalDateTime(List<String> path, Supplier<LocalDateTime> defaultValue)
      Get a local date time from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a LocalDateTime, or any element of the path preceding the final key is not a table.
    • isLocalDate

      default boolean isLocalDate(String dottedKey)
      Check if a value in the TOML document is a LocalDate.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as a LocalDate.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isLocalDate

      default boolean isLocalDate(List<String> path)
      Check if a value in the TOML document is a LocalDate.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a LocalDate.
    • getLocalDate

      default @Nullable LocalDate getLocalDate(String dottedKey)
      Get a local date from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a LocalDate, or any element of the path preceding the final key is not a table.
    • getLocalDate

      default @Nullable LocalDate getLocalDate(List<String> path)
      Get a local date from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a LocalDate, or any element of the path preceding the final key is not a table.
    • getLocalDate

      default LocalDate getLocalDate(String dottedKey, Supplier<LocalDate> defaultValue)
      Get a local date from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a LocalDate, or any element of the path preceding the final key is not a table.
    • getLocalDate

      default LocalDate getLocalDate(List<String> path, Supplier<LocalDate> defaultValue)
      Get a local date from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a LocalDate, or any element of the path preceding the final key is not a table.
    • isLocalTime

      default boolean isLocalTime(String dottedKey)
      Check if a value in the TOML document is a LocalTime.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      true if the value can be obtained as a LocalTime.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isLocalTime

      default boolean isLocalTime(List<String> path)
      Check if a value in the TOML document is a LocalTime.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a LocalTime.
    • getLocalTime

      default @Nullable LocalTime getLocalTime(String dottedKey)
      Get a local time from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a LocalTime, or any element of the path preceding the final key is not a table.
    • getLocalTime

      default @Nullable LocalTime getLocalTime(List<String> path)
      Get a local time from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a LocalTime, or any element of the path preceding the final key is not a table.
    • getLocalTime

      default LocalTime getLocalTime(String dottedKey, Supplier<LocalTime> defaultValue)
      Get a local time from the TOML document, or return a default.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a LocalTime, or any element of the path preceding the final key is not a table.
    • getLocalTime

      default LocalTime getLocalTime(List<String> path, Supplier<LocalTime> defaultValue)
      Get a local time from the TOML document, or return a default.
      Parameters:
      path - The key path.
      defaultValue - A supplier for the default value.
      Returns:
      The value, or the default.
      Throws:
      TomlInvalidTypeException - If the value is present but not a LocalTime, or any element of the path preceding the final key is not a table.
    • isArray

      default boolean isArray(String dottedKey)
      Check if a value in the TOML document is an array.
      Parameters:
      dottedKey - A dotted key (e.g. "server.addresses").
      Returns:
      true if the value can be obtained as an array.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isArray

      default boolean isArray(List<String> path)
      Check if a value in the TOML document is an array.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as an array.
    • getArray

      default @Nullable TomlArray getArray(String dottedKey)
      Get an array from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.addresses").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not an array, or any element of the path preceding the final key is not a table.
    • getArray

      default @Nullable TomlArray getArray(List<String> path)
      Get an array from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not an array, or any element of the path preceding the final key is not a table.
    • getArrayOrEmpty

      default TomlArray getArrayOrEmpty(String dottedKey)
      Get an array from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.addresses").
      Returns:
      The value, or an empty array if no array was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not an array, or any element of the path preceding the final key is not a table.
    • getArrayOrEmpty

      default TomlArray getArrayOrEmpty(List<String> path)
      Get an array from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or an empty array if no array was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not an array, or any element of the path preceding the final key is not a table.
    • isTable

      default boolean isTable(String dottedKey)
      Check if a value in the TOML document is a table.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address").
      Returns:
      true if the value can be obtained as a table.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
    • isTable

      default boolean isTable(List<String> path)
      Check if a value in the TOML document is a table.
      Parameters:
      path - The key path.
      Returns:
      true if the value can be obtained as a table.
    • getTable

      default @Nullable TomlTable getTable(String dottedKey)
      Get a table from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address").
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a table, or any element of the path preceding the final key is not a table.
    • getTable

      default @Nullable TomlTable getTable(List<String> path)
      Get a table from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or null if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a table, or any element of the path preceding the final key is not a table.
    • getTableOrEmpty

      default TomlTable getTableOrEmpty(String dottedKey)
      Get a table from the TOML document.
      Parameters:
      dottedKey - A dotted key (e.g. "server.address.port").
      Returns:
      The value, or an empty table if no value was set in the TOML document.
      Throws:
      IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If the value is present but not a table, or any element of the path preceding the final key is not a table.
    • getTableOrEmpty

      default TomlTable getTableOrEmpty(List<String> path)
      Get a table from the TOML document.
      Parameters:
      path - The key path.
      Returns:
      The value, or an empty table if no value was set in the TOML document.
      Throws:
      TomlInvalidTypeException - If the value is present but not a table, or any element of the path preceding the final key is not a table.
    • toMap

      Map<String,Object> toMap()
      Get the elements of this array as a Map.

      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 Map.
    • toJson

      default String toJson(JsonOptions... options)
      Return a representation of this table 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 table 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 table 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 table 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 table using TOML.
      Returns:
      A TOML representation of this table.
    • toToml

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