Package org.tomlj

Interface TomlTable

All Known Subinterfaces:
TomlParseResult

@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 Summary

    Modifier and Type Method Description
    default boolean contains​(java.lang.String dottedKey)
    Check if a key was set in the TOML document.
    default boolean contains​(java.util.List<java.lang.String> path)
    Check if a key was set in the TOML document.
    default java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> dottedEntrySet()
    Get all the dotted entries of this table.
    default java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> dottedEntrySet​(boolean includeTables)
    Get all the dotted entries of this table.
    default java.util.Set<java.lang.String> dottedKeySet()
    Get all the dotted keys of this table.
    default java.util.Set<java.lang.String> dottedKeySet​(boolean includeTables)
    Get all the dotted keys of this table.
    default java.util.Set<java.util.Map.Entry<java.util.List<java.lang.String>,​java.lang.Object>> entryPathSet()
    Get all the entries in this table.
    java.util.Set<java.util.Map.Entry<java.util.List<java.lang.String>,​java.lang.Object>> entryPathSet​(boolean includeTables)
    Get all the entries in this table.
    java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()
    Get the entries of this table.
    default @Nullable java.lang.Object get​(java.lang.String dottedKey)
    Get a value from the TOML document.
    @Nullable java.lang.Object get​(java.util.List<java.lang.String> path)
    Get a value from the TOML document.
    default @Nullable TomlArray getArray​(java.lang.String dottedKey)
    Get an array from the TOML document.
    default @Nullable TomlArray getArray​(java.util.List<java.lang.String> path)
    Get an array from the TOML document.
    default TomlArray getArrayOrEmpty​(java.lang.String dottedKey)
    Get an array from the TOML document.
    default TomlArray getArrayOrEmpty​(java.util.List<java.lang.String> path)
    Get an array from the TOML document.
    default @Nullable java.lang.Boolean getBoolean​(java.lang.String dottedKey)
    Get a boolean from the TOML document.
    default boolean getBoolean​(java.lang.String dottedKey, java.util.function.BooleanSupplier defaultValue)
    Get a boolean from the TOML document, or return a default.
    default @Nullable java.lang.Boolean getBoolean​(java.util.List<java.lang.String> path)
    Get a boolean from the TOML document.
    default boolean getBoolean​(java.util.List<java.lang.String> path, java.util.function.BooleanSupplier defaultValue)
    Get a boolean from the TOML document, or return a default.
    default @Nullable java.lang.Double getDouble​(java.lang.String dottedKey)
    Get a double from the TOML document.
    default double getDouble​(java.lang.String dottedKey, java.util.function.DoubleSupplier defaultValue)
    Get a double from the TOML document, or return a default.
    default @Nullable java.lang.Double getDouble​(java.util.List<java.lang.String> path)
    Get a double from the TOML document.
    default double getDouble​(java.util.List<java.lang.String> path, java.util.function.DoubleSupplier defaultValue)
    Get a double from the TOML document, or return a default.
    default @Nullable java.time.LocalDate getLocalDate​(java.lang.String dottedKey)
    Get a local date from the TOML document.
    default java.time.LocalDate getLocalDate​(java.lang.String dottedKey, java.util.function.Supplier<java.time.LocalDate> defaultValue)
    Get a local date from the TOML document, or return a default.
    default @Nullable java.time.LocalDate getLocalDate​(java.util.List<java.lang.String> path)
    Get a local date from the TOML document.
    default java.time.LocalDate getLocalDate​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.LocalDate> defaultValue)
    Get a local date from the TOML document, or return a default.
    default @Nullable java.time.LocalDateTime getLocalDateTime​(java.lang.String dottedKey)
    Get a local date time from the TOML document.
    default java.time.LocalDateTime getLocalDateTime​(java.lang.String dottedKey, java.util.function.Supplier<java.time.LocalDateTime> defaultValue)
    Get a local date time from the TOML document, or return a default.
    default @Nullable java.time.LocalDateTime getLocalDateTime​(java.util.List<java.lang.String> path)
    Get a local date time from the TOML document.
    default java.time.LocalDateTime getLocalDateTime​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.LocalDateTime> defaultValue)
    Get a local date time from the TOML document, or return a default.
    default @Nullable java.time.LocalTime getLocalTime​(java.lang.String dottedKey)
    Get a local time from the TOML document.
    default java.time.LocalTime getLocalTime​(java.lang.String dottedKey, java.util.function.Supplier<java.time.LocalTime> defaultValue)
    Get a local time from the TOML document, or return a default.
    default @Nullable java.time.LocalTime getLocalTime​(java.util.List<java.lang.String> path)
    Get a local time from the TOML document.
    default java.time.LocalTime getLocalTime​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.LocalTime> defaultValue)
    Get a local time from the TOML document, or return a default.
    default @Nullable java.lang.Long getLong​(java.lang.String dottedKey)
    Get a long from the TOML document.
    default long getLong​(java.lang.String dottedKey, java.util.function.LongSupplier defaultValue)
    Get a long from the TOML document, or return a default.
    default @Nullable java.lang.Long getLong​(java.util.List<java.lang.String> path)
    Get a long from the TOML document.
    default long getLong​(java.util.List<java.lang.String> path, java.util.function.LongSupplier defaultValue)
    Get a long from the TOML document, or return a default.
    default @Nullable java.time.OffsetDateTime getOffsetDateTime​(java.lang.String dottedKey)
    Get an offset date time from the TOML document.
    default java.time.OffsetDateTime getOffsetDateTime​(java.lang.String dottedKey, java.util.function.Supplier<java.time.OffsetDateTime> defaultValue)
    Get an offset date time from the TOML document, or return a default.
    default @Nullable java.time.OffsetDateTime getOffsetDateTime​(java.util.List<java.lang.String> path)
    Get an offset date time from the TOML document.
    default java.time.OffsetDateTime getOffsetDateTime​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.OffsetDateTime> defaultValue)
    Get an offset date time from the TOML document, or return a default.
    default @Nullable java.lang.String getString​(java.lang.String dottedKey)
    Get a string from the TOML document.
    default java.lang.String getString​(java.lang.String dottedKey, java.util.function.Supplier<java.lang.String> defaultValue)
    Get a string from the TOML document, or return a default.
    default @Nullable java.lang.String getString​(java.util.List<java.lang.String> path)
    Get a string from the TOML document.
    default java.lang.String getString​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.lang.String> defaultValue)
    Get a string from the TOML document, or return a default.
    default @Nullable TomlTable getTable​(java.lang.String dottedKey)
    Get a table from the TOML document.
    default @Nullable TomlTable getTable​(java.util.List<java.lang.String> path)
    Get a table from the TOML document.
    default TomlTable getTableOrEmpty​(java.lang.String dottedKey)
    Get a table from the TOML document.
    default TomlTable getTableOrEmpty​(java.util.List<java.lang.String> path)
    Get a table from the TOML document.
    default @Nullable TomlPosition inputPositionOf​(java.lang.String dottedKey)
    Get the position where a key is defined in the TOML document.
    @Nullable TomlPosition inputPositionOf​(java.util.List<java.lang.String> path)
    Get the position where a key is defined in the TOML document.
    default boolean isArray​(java.lang.String dottedKey)
    Check if a value in the TOML document is an array.
    default boolean isArray​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is an array.
    default boolean isBoolean​(java.lang.String dottedKey)
    Check if a value in the TOML document is a boolean.
    default boolean isBoolean​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a boolean.
    default boolean isDouble​(java.lang.String dottedKey)
    Check if a value in the TOML document is a double.
    default boolean isDouble​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a double.
    boolean isEmpty()
    true if there are no entries in this table.
    default boolean isLocalDate​(java.lang.String dottedKey)
    Check if a value in the TOML document is a LocalDate.
    default boolean isLocalDate​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a LocalDate.
    default boolean isLocalDateTime​(java.lang.String dottedKey)
    Check if a value in the TOML document is a LocalDateTime.
    default boolean isLocalDateTime​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a LocalDateTime.
    default boolean isLocalTime​(java.lang.String dottedKey)
    Check if a value in the TOML document is a LocalTime.
    default boolean isLocalTime​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a LocalTime.
    default boolean isLong​(java.lang.String dottedKey)
    Check if a value in the TOML document is a long.
    default boolean isLong​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a long.
    default boolean isOffsetDateTime​(java.lang.String dottedKey)
    Check if a value in the TOML document is an OffsetDateTime.
    default boolean isOffsetDateTime​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is an OffsetDateTime.
    default boolean isString​(java.lang.String dottedKey)
    Check if a value in the TOML document is a string.
    default boolean isString​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a string.
    default boolean isTable​(java.lang.String dottedKey)
    Check if a value in the TOML document is a table.
    default boolean isTable​(java.util.List<java.lang.String> path)
    Check if a value in the TOML document is a table.
    default java.util.Set<java.util.List<java.lang.String>> keyPathSet()
    Get all the paths in this table.
    java.util.Set<java.util.List<java.lang.String>> keyPathSet​(boolean includeTables)
    Get all the paths in this table.
    java.util.Set<java.lang.String> keySet()
    Get the keys of this table.
    int size()
    Return the number of entries in tis table.
    default void toJson​(java.lang.Appendable appendable, java.util.EnumSet<JsonOptions> options)
    Append a JSON representation of this table to the appendable output.
    default void toJson​(java.lang.Appendable appendable, JsonOptions... options)
    Append a JSON representation of this table to the appendable output.
    default java.lang.String toJson​(java.util.EnumSet<JsonOptions> options)
    Return a representation of this table using JSON.
    default java.lang.String toJson​(JsonOptions... options)
    Return a representation of this table using JSON.
    java.util.Map<java.lang.String,​java.lang.Object> toMap()
    Get the elements of this array as a Map.
    default java.lang.String toToml()
    Return a representation of this table using TOML.
    default void toToml​(java.lang.Appendable appendable)
    Append a TOML representation of this table to the appendable output.
  • 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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • contains

      default boolean contains​(java.util.List<java.lang.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

      java.util.Set<java.lang.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 java.util.Set<java.lang.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 java.util.Set<java.lang.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 java.util.Set<java.util.List<java.lang.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

      java.util.Set<java.util.List<java.lang.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

      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.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 java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.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 java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.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 java.util.Set<java.util.Map.Entry<java.util.List<java.lang.String>,​java.lang.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

      java.util.Set<java.util.Map.Entry<java.util.List<java.lang.String>,​java.lang.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 java.lang.Object get​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
      TomlInvalidTypeException - If any element of the path preceding the final key is not a table.
    • get

      @Nullable java.lang.Object get​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.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​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isString

      default boolean isString​(java.util.List<java.lang.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 java.lang.String getString​(java.lang.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:
      java.lang.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 java.lang.String getString​(java.util.List<java.lang.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 java.lang.String getString​(java.lang.String dottedKey, java.util.function.Supplier<java.lang.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:
      java.lang.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 java.lang.String getString​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.lang.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isLong

      default boolean isLong​(java.util.List<java.lang.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 java.lang.Long getLong​(java.lang.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:
      java.lang.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 java.lang.Long getLong​(java.util.List<java.lang.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​(java.lang.String dottedKey, java.util.function.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:
      java.lang.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​(java.util.List<java.lang.String> path, java.util.function.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isDouble

      default boolean isDouble​(java.util.List<java.lang.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 java.lang.Double getDouble​(java.lang.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:
      java.lang.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 java.lang.Double getDouble​(java.util.List<java.lang.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​(java.lang.String dottedKey, java.util.function.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:
      java.lang.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​(java.util.List<java.lang.String> path, java.util.function.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isBoolean

      default boolean isBoolean​(java.util.List<java.lang.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 java.lang.Boolean getBoolean​(java.lang.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:
      java.lang.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 java.lang.Boolean getBoolean​(java.util.List<java.lang.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​(java.lang.String dottedKey, java.util.function.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:
      java.lang.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​(java.util.List<java.lang.String> path, java.util.function.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isOffsetDateTime

      default boolean isOffsetDateTime​(java.util.List<java.lang.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 java.time.OffsetDateTime getOffsetDateTime​(java.lang.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:
      java.lang.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 java.time.OffsetDateTime getOffsetDateTime​(java.util.List<java.lang.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 java.time.OffsetDateTime getOffsetDateTime​(java.lang.String dottedKey, java.util.function.Supplier<java.time.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:
      java.lang.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 java.time.OffsetDateTime getOffsetDateTime​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isLocalDateTime

      default boolean isLocalDateTime​(java.util.List<java.lang.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 java.time.LocalDateTime getLocalDateTime​(java.lang.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:
      java.lang.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 java.time.LocalDateTime getLocalDateTime​(java.util.List<java.lang.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 java.time.LocalDateTime getLocalDateTime​(java.lang.String dottedKey, java.util.function.Supplier<java.time.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:
      java.lang.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 java.time.LocalDateTime getLocalDateTime​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isLocalDate

      default boolean isLocalDate​(java.util.List<java.lang.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 java.time.LocalDate getLocalDate​(java.lang.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:
      java.lang.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 java.time.LocalDate getLocalDate​(java.util.List<java.lang.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 java.time.LocalDate getLocalDate​(java.lang.String dottedKey, java.util.function.Supplier<java.time.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:
      java.lang.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 java.time.LocalDate getLocalDate​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isLocalTime

      default boolean isLocalTime​(java.util.List<java.lang.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 java.time.LocalTime getLocalTime​(java.lang.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:
      java.lang.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 java.time.LocalTime getLocalTime​(java.util.List<java.lang.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 java.time.LocalTime getLocalTime​(java.lang.String dottedKey, java.util.function.Supplier<java.time.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:
      java.lang.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 java.time.LocalTime getLocalTime​(java.util.List<java.lang.String> path, java.util.function.Supplier<java.time.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isArray

      default boolean isArray​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.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​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.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​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.IllegalArgumentException - If the key cannot be parsed.
    • isTable

      default boolean isTable​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.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​(java.util.List<java.lang.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​(java.lang.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:
      java.lang.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​(java.util.List<java.lang.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

      java.util.Map<java.lang.String,​java.lang.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 java.lang.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 java.lang.String toJson​(java.util.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​(java.lang.Appendable appendable, JsonOptions... options) throws java.io.IOException
      Append a JSON representation of this table to the appendable output.
      Parameters:
      appendable - The appendable output.
      options - Options for the JSON encoder.
      Throws:
      java.io.IOException - If an IO error occurs.
    • toJson

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

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

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