Package org.tomlj

Class MutableTomlTable

  • All Implemented Interfaces:
    TomlTable

    final class MutableTomlTable
    extends java.lang.Object
    implements TomlTable
    • Method Detail

      • isDefined

        boolean isDefined()
      • size

        public int size()
        Description copied from interface: TomlTable
        Return the number of entries in tis table.
        Specified by:
        size in interface TomlTable
        Returns:
        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.
        Specified by:
        isEmpty in interface TomlTable
        Returns:
        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() or TomlTable.keyPathSet().

        Specified by:
        keySet in interface TomlTable
        Returns:
        A set containing the keys of this table.
      • 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 interface TomlTable
        Parameters:
        includeTables - If true, 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() or TomlTable.entryPathSet().

        Specified by:
        entrySet in interface TomlTable
        Returns:
        A set containing the immediate entries of this table.
      • 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 interface TomlTable
        Parameters:
        includeTables - If true, 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.
        Specified by:
        get in interface TomlTable
        Parameters:
        path - The key path.
        Returns:
        The value, or null if no value was set in 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 interface TomlTable
        Parameters:
        path - The key path.
        Returns:
        The input position, or null if the key was not set in the TOML document.
      • toMap

        public java.util.Map<java.lang.String,​java.lang.Object> toMap()
        Description copied from interface: TomlTable
        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.

        Specified by:
        toMap in interface TomlTable
        Returns:
        The elements of this array as a Map.
      • 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.