Class ConfigNode

java.lang.Object
com.djrapitops.plan.settings.config.ConfigNode
Direct Known Subclasses:
Config

public class ConfigNode extends Object
Represents a single node in a configuration file
  • Field Details Link icon

  • Constructor Details Link icon

  • Method Details Link icon

    • updateParent Link icon

      protected void updateParent(ConfigNode newParent)
    • getNode Link icon

      public Optional<ConfigNode> getNode(String path)
    • contains Link icon

      public boolean contains(String path)
    • addNode Link icon

      public ConfigNode addNode(String path)
    • removeNode Link icon

      public boolean removeNode(String path)
      Remove a node at a certain path.
      Parameters:
      path - Path to the node that is up for removal.
      Returns:
      true if the node was present and is now removed. false if the path did not have a node.
    • remove Link icon

      public void remove()
    • addChild Link icon

      protected ConfigNode addChild(ConfigNode child)
      Add a new child ConfigNode.
      Parameters:
      child - ConfigNode to add. If from another config tree, the parent is 'cut', which breaks the old tree traversal.
      Returns:
      Return the node given, now part of this tree.
    • removeChild Link icon

      protected void removeChild(ConfigNode child)
    • moveChild Link icon

      public boolean moveChild(String oldPath, String newPath)
      Moves a node from old path to new path.
      Parameters:
      oldPath - Old path of the node.
      newPath - New path of the node.
      Returns:
      true if the move was successful. false if the new node is not present
    • getKey Link icon

      public String getKey(boolean deep)
    • sort Link icon

      public void sort()
    • reorder Link icon

      public void reorder(List<String> newOrder)
    • save Link icon

      public void save() throws IOException
      Find the root node and save.
      Throws:
      IOException - If the save can not be performed.
    • set Link icon

      public <T> void set(String path, T value)
    • set Link icon

      public <T> void set(T value)
    • getComment Link icon

      public List<String> getComment()
    • setComment Link icon

      public void setComment(List<String> comment)
    • getStringList Link icon

      public List<String> getStringList()
    • getInteger Link icon

      public Integer getInteger()
    • getLong Link icon

      public Long getLong()
    • getString Link icon

      public String getString()
    • getDouble Link icon

      public Double getDouble()
    • getBoolean Link icon

      public boolean getBoolean()
    • getStringList Link icon

      public List<String> getStringList(String path)
    • getStringMap Link icon

      public Map<String,String> getStringMap(boolean fullKeys)
      Return values in a Map.
      Parameters:
      fullKeys - Should the key be full keys of the Config node.
      Returns:
      Map with Config key - ConfigNode#getString.
    • getConfigPaths Link icon

      public List<String> getConfigPaths()
      Returns:
      List of config keys
    • dfs Link icon

      public <T> List<T> dfs(BiConsumer<ConfigNode,List<T>> accessVisitor)
    • getInteger Link icon

      public Integer getInteger(String path)
    • getLong Link icon

      public Long getLong(String path)
    • getString Link icon

      public String getString(String path)
    • getBoolean Link icon

      public boolean getBoolean(String path)
    • getDouble Link icon

      public Double getDouble(String path)
    • copyMissing Link icon

      public void copyMissing(ConfigNode from)
    • copyAll Link icon

      public void copyAll(ConfigNode from)
    • copyValue Link icon

      public void copyValue(ConfigNode from)
    • getNodeDepth Link icon

      protected int getNodeDepth()
    • getParent Link icon

      public ConfigNode getParent()
    • isLeafNode Link icon

      public boolean isLeafNode()
    • getNodeOrder Link icon

      protected List<String> getNodeOrder()
    • getChildren Link icon

      public Collection<ConfigNode> getChildren()
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object