Interface TomlTable

All Superinterfaces:
TomlValue
All Known Subinterfaces:
TomlDocument

@NonExtendable public interface TomlTable extends TomlValue
TOML key-values
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the table
    boolean
    contains(@NotNull TomlKey key)
    Returns true if the given key has a mapping within this table.
    default boolean
    contains(@NotNull CharSequence key)
    Returns true if the given key has a mapping within this table.
    static @NotNull TomlTable
    copyOf(@NotNull TomlTable other)
    Creates a new table which contains a deep copy of the given table
    static @NotNull TomlTable
    Creates an empty table
    @Nullable TomlValue
    get(@NotNull TomlKey key)
    Gets the value mapped to the given key, or null if no entry exists.
    default @Nullable TomlValue
    get(@NotNull CharSequence key)
    Gets the value mapped to the given key, or null if no entry exists.
    boolean
     
    default @NotNull @Unmodifiable Set<TomlKey>
    Reports the keys present in this table recursively in lexicographical order.
    @NotNull @Unmodifiable Set<TomlKey>
    keys(boolean deep)
    Reports the keys in this table in lexicographical order.
    default @Nullable TomlValue
    put(@NotNull TomlKey key, boolean value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull TomlKey key, double value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull TomlKey key, float value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull TomlKey key, int value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull TomlKey key, long value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    @Nullable TomlValue
    put(@NotNull TomlKey key, @NotNull TomlValue value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull TomlKey key, @NotNull String value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, boolean value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, double value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, float value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, int value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, long value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, @NotNull TomlValue value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    default @Nullable TomlValue
    put(@NotNull CharSequence key, @NotNull String value)
    Updates the value mapped to the given key, creating a new entry if one does not exist.
    @Nullable TomlValue
    remove(@NotNull TomlKey key)
    Removes the entry associated with the given key.
    default @Nullable TomlValue
    remove(@NotNull String key)
    Removes the entry associated with the given key.
    int
    Reports the number of entries in this map.
    default @NotNull Map<TomlKey,TomlValue>
    Creates a new map which contains a flattened view of this table.

    Methods inherited from interface io.github.wasabithumb.jtoml.value.TomlValue

    asArray, asPrimitive, asTable, comments, creationTime, flags, flags, isArray, isPrimitive, isTable
  • Method Details

    • create

      @Contract("-> new") @NotNull static @NotNull TomlTable create()
      Creates an empty table
    • copyOf

      @Contract("_ -> new") @NotNull static @NotNull TomlTable copyOf(@NotNull @NotNull TomlTable other)
      Creates a new table which contains a deep copy of the given table
    • size

      @Contract(pure=true) int size()

      Reports the number of entries in this map. This is not the same as the number of mappings. For instance, adding an empty map to a map will not cause the size of the map to increase.

      This is defined to be identical to keys().size().

      See Also:
    • isEmpty

      boolean isEmpty()
      Returns:
      True if the table is empty
    • clear

      void clear()
      Clears the table
    • keys

      @NotNull @NotNull @Unmodifiable Set<TomlKey> keys(boolean deep)
      Reports the keys in this table in lexicographical order.
      Parameters:
      deep - If true, children will be traversed (as in keys()). Otherwise only the top-level keys are reported, each having a length of 1.
    • keys

      @NotNull default @NotNull @Unmodifiable Set<TomlKey> keys()
      Reports the keys present in this table recursively in lexicographical order. Keys that map to tables are not included.
      See Also:
    • contains

      boolean contains(@NotNull @NotNull TomlKey key)
      Returns true if the given key has a mapping within this table. This will return true for keys mapped to tables, including empty tables.
    • contains

      default boolean contains(@NotNull @NotNull CharSequence key)
      Returns true if the given key has a mapping within this table. This will return true for keys mapped to tables, including empty tables. The key is parsed as specified by TomlKey.parse(CharSequence).
      See Also:
    • get

      @Nullable @Nullable TomlValue get(@NotNull @NotNull TomlKey key)
      Gets the value mapped to the given key, or null if no entry exists.
    • get

      @Nullable default @Nullable TomlValue get(@NotNull @NotNull CharSequence key)
      Gets the value mapped to the given key, or null if no entry exists. The key is parsed as specified by TomlKey.parse(CharSequence).
      See Also:
    • put

      @Nullable @Nullable TomlValue put(@NotNull @NotNull TomlKey key, @NotNull @NotNull TomlValue value)
      Updates the value mapped to the given key, creating a new entry if one does not exist.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, @NotNull @NotNull TomlValue value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull TomlKey key, @NotNull @NotNull String value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull TomlKey key, boolean value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull TomlKey key, long value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull TomlKey key, int value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull TomlKey key, double value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull TomlKey key, float value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map.
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, @NotNull @NotNull String value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, boolean value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, long value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, int value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, double value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • put

      @Nullable default @Nullable TomlValue put(@NotNull @NotNull CharSequence key, float value)
      Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into a TomlPrimitive before being placed into the map. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null the entry was newly created
      See Also:
    • remove

      @Nullable @Nullable TomlValue remove(@NotNull @NotNull TomlKey key)
      Removes the entry associated with the given key.
      Returns:
      The value previously mapped to the given key, or null if no entry exists.
    • remove

      @Nullable default @Nullable TomlValue remove(@NotNull @NotNull String key)
      Removes the entry associated with the given key. The key is parsed as specified by TomlKey.parse(CharSequence).
      Returns:
      The value previously mapped to the given key, or null if no entry exists.
      See Also:
    • toMap

      @Contract("-> new") @NotNull default @NotNull Map<TomlKey,TomlValue> toMap()
      Creates a new map which contains a flattened view of this table. The resulting table is ordered arbitrarily.