Interface TomlTable
- All Superinterfaces:
TomlValue
- All Known Subinterfaces:
TomlDocument
TOML key-values
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the tablebooleanReturns true if the given key has a mapping within this table.default booleancontains(@NotNull CharSequence key) Returns true if the given key has a mapping within this table.static @NotNull TomlTableCreates a new table which contains a deep copy of the given tablestatic @NotNull TomlTablecreate()Creates an empty table@Nullable TomlValueGets the value mapped to the given key, or null if no entry exists.default @Nullable TomlValueget(@NotNull CharSequence key) Gets the value mapped to the given key, or null if no entry exists.booleanisEmpty()keys()Reports the keys present in this table recursively in lexicographical order.keys(boolean deep) Reports the keys in this table in lexicographical order.default @Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.@Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueUpdates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueput(@NotNull CharSequence key, boolean value) Updates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueput(@NotNull CharSequence key, double value) Updates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueput(@NotNull CharSequence key, float value) Updates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueput(@NotNull CharSequence key, int value) Updates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueput(@NotNull CharSequence key, long value) Updates the value mapped to the given key, creating a new entry if one does not exist.default @Nullable TomlValueput(@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 TomlValueput(@NotNull CharSequence key, @NotNull String value) Updates the value mapped to the given key, creating a new entry if one does not exist.@Nullable TomlValueRemoves the entry associated with the given key.default @Nullable TomlValueRemoves the entry associated with the given key.intsize()Reports the number of entries in this map.toMap()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
Creates an empty table -
copyOf
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
Reports the keys in this table in lexicographical order.- Parameters:
deep- If true, children will be traversed (as inkeys()). Otherwise only the top-level keys are reported, each having a length of 1.
-
keys
Reports the keys present in this table recursively in lexicographical order. Keys that map to tables are not included.- See Also:
-
contains
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
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 byTomlKey.parse(CharSequence).- See Also:
-
get
Gets the value mapped to the given key, or null if no entry exists. -
get
Gets the value mapped to the given key, or null if no entry exists. The key is parsed as specified byTomlKey.parse(CharSequence).- See Also:
-
put
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 byTomlKey.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 aTomlPrimitivebefore being placed into the map.- Returns:
- The value previously mapped to the given key, or null the entry was newly created
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map.- Returns:
- The value previously mapped to the given key, or null the entry was newly created
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map.- Returns:
- The value previously mapped to the given key, or null the entry was newly created
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map.- Returns:
- The value previously mapped to the given key, or null the entry was newly created
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map.- Returns:
- The value previously mapped to the given key, or null the entry was newly created
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore 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 aTomlPrimitivebefore being placed into the map. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null the entry was newly created
- See Also:
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null the entry was newly created
- See Also:
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null the entry was newly created
- See Also:
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null the entry was newly created
- See Also:
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null the entry was newly created
- See Also:
-
put
Updates the value mapped to the given key, creating a new entry if one does not exist. The value is wrapped into aTomlPrimitivebefore being placed into the map. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null the entry was newly created
- See Also:
-
remove
Removes the entry associated with the given key.- Returns:
- The value previously mapped to the given key, or null if no entry exists.
-
remove
Removes the entry associated with the given key. The key is parsed as specified byTomlKey.parse(CharSequence).- Returns:
- The value previously mapped to the given key, or null if no entry exists.
- See Also:
-
toMap
Creates a new map which contains a flattened view of this table. The resulting table is ordered arbitrarily.
-