Package org.tomlj
Class MutableTomlTable
- java.lang.Object
-
- org.tomlj.MutableTomlTable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MutableTomlTable.Element
private static class
MutableTomlTable.EnsureTableResult
-
Field Summary
Fields Modifier and Type Field Description private TomlPosition
definedAt
private java.util.Map<java.lang.String,MutableTomlTable.Element>
properties
private TomlVersion
version
-
Constructor Summary
Constructors Constructor Description MutableTomlTable(TomlVersion version)
MutableTomlTable(TomlVersion version, TomlPosition definedAt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) MutableTomlTable
createTable(java.util.List<java.lang.String> path, TomlPosition position)
(package private) MutableTomlTable
createTableArray(java.util.List<java.lang.String> path, TomlPosition position)
(package private) void
define(TomlPosition position)
private MutableTomlTable.EnsureTableResult
ensureTable(java.util.List<java.lang.String> path, TomlPosition position, boolean followTableArrays, boolean followDefinedTables)
Ensure a table exists at a given path.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.@Nullable java.lang.Object
get(java.util.List<java.lang.String> path)
Get a value from the TOML document.private MutableTomlTable.Element
getElement(java.util.List<java.lang.String> path)
@Nullable TomlPosition
inputPositionOf(java.util.List<java.lang.String> path)
Get the position where a key is defined in the TOML document.(package private) boolean
isDefined()
boolean
isEmpty()
true
if there are no entries 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.(package private) java.util.List<java.util.AbstractMap.SimpleEntry<MutableTomlTable,TomlPosition>>
set(java.lang.String keyPath, java.lang.Object value, TomlPosition position)
(package private) java.util.List<java.util.AbstractMap.SimpleEntry<MutableTomlTable,TomlPosition>>
set(java.util.List<java.lang.String> path, java.lang.Object value, TomlPosition position)
int
size()
Return the number of entries in tis table.java.util.Map<java.lang.String,java.lang.Object>
toMap()
Get the elements of this array as aMap
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tomlj.TomlTable
contains, contains, dottedEntrySet, dottedEntrySet, dottedKeySet, dottedKeySet, entryPathSet, get, getArray, getArray, getArrayOrEmpty, getArrayOrEmpty, getBoolean, getBoolean, getBoolean, getBoolean, getDouble, getDouble, getDouble, getDouble, getLocalDate, getLocalDate, getLocalDate, getLocalDate, getLocalDateTime, getLocalDateTime, getLocalDateTime, getLocalDateTime, getLocalTime, getLocalTime, getLocalTime, getLocalTime, getLong, getLong, getLong, getLong, getOffsetDateTime, getOffsetDateTime, getOffsetDateTime, getOffsetDateTime, getString, getString, getString, getString, getTable, getTable, getTableOrEmpty, getTableOrEmpty, inputPositionOf, isArray, isArray, isBoolean, isBoolean, isDouble, isDouble, isLocalDate, isLocalDate, isLocalDateTime, isLocalDateTime, isLocalTime, isLocalTime, isLong, isLong, isOffsetDateTime, isOffsetDateTime, isString, isString, isTable, isTable, keyPathSet, toJson, toJson, toJson, toJson, toToml, toToml
-
-
-
-
Field Detail
-
properties
private final java.util.Map<java.lang.String,MutableTomlTable.Element> properties
-
version
private final TomlVersion version
-
definedAt
private TomlPosition definedAt
-
-
Constructor Detail
-
MutableTomlTable
MutableTomlTable(TomlVersion version, TomlPosition definedAt)
-
MutableTomlTable
MutableTomlTable(TomlVersion version)
-
-
Method Detail
-
isDefined
boolean isDefined()
-
define
void define(TomlPosition position)
-
size
public int size()
Description copied from interface:TomlTable
Return the number of entries in tis table.
-
isEmpty
public boolean isEmpty()
Description copied from interface:TomlTable
true
if there are no entries in this table.
-
keySet
public java.util.Set<java.lang.String> keySet()
Description copied from interface:TomlTable
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
TomlTable.dottedKeySet()
orTomlTable.keyPathSet()
.
-
keyPathSet
public java.util.Set<java.util.List<java.lang.String>> keyPathSet(boolean includeTables)
Description copied from interface:TomlTable
Get all the paths in this table.- Specified by:
keyPathSet
in interfaceTomlTable
- Parameters:
includeTables
- Iftrue
, also include paths to intermediary and empty tables.- Returns:
- A set containing all the key paths of this table.
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Description copied from interface:TomlTable
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
TomlTable.dottedEntrySet()
orTomlTable.entryPathSet()
.
-
entryPathSet
public java.util.Set<java.util.Map.Entry<java.util.List<java.lang.String>,java.lang.Object>> entryPathSet(boolean includeTables)
Description copied from interface:TomlTable
Get all the entries in this table.- Specified by:
entryPathSet
in interfaceTomlTable
- Parameters:
includeTables
- Iftrue
, also include entries in intermediary and empty tables.- Returns:
- A set containing all the entries of this table.
-
get
public @Nullable java.lang.Object get(java.util.List<java.lang.String> path)
Description copied from interface:TomlTable
Get a value from the TOML document.
-
inputPositionOf
public @Nullable TomlPosition inputPositionOf(java.util.List<java.lang.String> path)
Description copied from interface:TomlTable
Get the position where a key is defined in the TOML document.- Specified by:
inputPositionOf
in interfaceTomlTable
- Parameters:
path
- The key path.- Returns:
- The input position, or
null
if the key was not set in the TOML document.
-
getElement
private MutableTomlTable.Element getElement(java.util.List<java.lang.String> path)
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()
Description copied from interface:TomlTable
-
createTable
MutableTomlTable createTable(java.util.List<java.lang.String> path, TomlPosition position)
-
createTableArray
MutableTomlTable createTableArray(java.util.List<java.lang.String> path, TomlPosition position)
-
set
java.util.List<java.util.AbstractMap.SimpleEntry<MutableTomlTable,TomlPosition>> set(java.lang.String keyPath, java.lang.Object value, TomlPosition position)
-
set
java.util.List<java.util.AbstractMap.SimpleEntry<MutableTomlTable,TomlPosition>> set(java.util.List<java.lang.String> path, java.lang.Object value, TomlPosition position)
-
ensureTable
private MutableTomlTable.EnsureTableResult ensureTable(java.util.List<java.lang.String> path, TomlPosition position, boolean followTableArrays, boolean followDefinedTables)
Ensure a table exists at a given path.- Parameters:
path
- The path to ensure exists (as a table)position
- The input position.followTableArrays
- If `true`, path walking is permitted via the last element of array tables.followDefinedTables
- Allow path walking through defined tables.- Returns:
- The
- Throws:
TomlParseError
- If the table cannot be created.
-
-