Package org.tomlj

Interface MutableTomlTable

All Superinterfaces:
TomlTable
All Known Subinterfaces:
TomlParseResult

public interface MutableTomlTable extends TomlTable
A TomlTable whose values can be edited in place.

A value set through this interface is any value a TomlTable can hold. An Integer, Short or Byte is widened to a Long and a Float to a Double; a Map with String keys becomes a table and a Collection an array, their values converted the same way; a TomlValue stores what it holds. null throws a NullPointerException and anything else an IllegalArgumentException.

A key or a String value must not contain an unpaired surrogate, an OffsetDateTime's offset must be a whole number of minutes, and a LocalDate, LocalDateTime or OffsetDateTime must have a year between 0 and 9999, since none of these can be written as TOML.

A TomlTable or TomlArray stored as a value is stored as a deep copy, so later changes to the original are not seen; the stored copy is edited through the getters that return it.

An entry's attached comments are edited through its MutableTomlKeyValue (or MutableTomlEntry) obtained from entry(java.lang.String), or through the shortcuts here. An unattached comment is added after the last element with addComment(java.lang.String...) and removed with removeComment(java.lang.String, org.tomlj.TomlComment.Placement); it can also be inserted before or after an entry with insertCommentBefore(java.lang.String, java.lang.String...) or insertCommentAfter(java.lang.String, java.lang.String...). An entry or a comment can also be inserted before or after any element of this table's sequence, as TomlTable.elements() returns it, with insertBefore(java.lang.String, java.lang.String, java.lang.Object), insertAfter(java.lang.String, java.lang.String, java.lang.Object), insertCommentBefore(java.lang.String, java.lang.String...), or insertCommentAfter(java.lang.String, java.lang.String...).

A table is written back out with TomlTable.toToml(), and reformat(TomlWriteOptions.Keep) makes it, and everything nested in it, keep less of its existing structure and format.

Not safe for use from multiple threads without external synchronization.