Class GsonConfig.GsonConfigNode

java.lang.Object
io.github.projectunified.craftconfig.gson.GsonConfig.GsonConfigNode
All Implemented Interfaces:
ConfigNode
Enclosing class:
GsonConfig

public class GsonConfig.GsonConfigNode extends Object implements ConfigNode
Gson implementation of ConfigNode.
  • Method Details

    • getPath

      public String[] getPath()
      Description copied from interface: ConfigNode
      Get the path relative to the origin node. When obtained from Config.node(), returns the full path from root. When obtained from ConfigNode.node() or getChildren(), returns the relative path.
      Specified by:
      getPath in interface ConfigNode
      Returns:
      the path segments
    • getParent

      public ConfigNode getParent()
      Description copied from interface: ConfigNode
      Get the parent node (the origin). When obtained from Config.node(), returns the Config (root node). When obtained from ConfigNode.node() or getChildren(), returns that ConfigNode.
      Specified by:
      getParent in interface ConfigNode
      Returns:
      the parent node
    • getConfig

      public Config getConfig()
      Description copied from interface: ConfigNode
      Get the root Config that owns this node
      Specified by:
      getConfig in interface ConfigNode
      Returns:
      the owning Config
    • get

      public Object get()
      Description copied from interface: ConfigNode
      Get the value at this node
      Specified by:
      get in interface ConfigNode
      Returns:
      the value, or null if not present
    • set

      public void set(Object value)
      Description copied from interface: ConfigNode
      Set the value at this node
      Specified by:
      set in interface ConfigNode
      Parameters:
      value - the value to set
    • node

      public ConfigNode node(String... path)
      Description copied from interface: ConfigNode
      Navigate to a child node. Should only be called if ConfigNode.hasChild() returns true.
      Specified by:
      node in interface ConfigNode
      Parameters:
      path - the path segments (relative to this node)
      Returns:
      the child node
    • remove

      public void remove()
      Description copied from interface: ConfigNode
      Remove this node from the configuration
      Specified by:
      remove in interface ConfigNode
    • hasChild

      public boolean hasChild()
      Description copied from interface: ConfigNode
      Check if this node has children
      Specified by:
      hasChild in interface ConfigNode
      Returns:
      true if this node has child nodes
    • getChildren

      public Map<String,ConfigNode> getChildren()
      Description copied from interface: ConfigNode
      Get the child nodes of this node. Should only be called if ConfigNode.hasChild() returns true.
      Specified by:
      getChildren in interface ConfigNode
      Returns:
      map of child key to child node
    • getNormalized

      public Object getNormalized()
      Description copied from interface: ConfigNode
      Get the normalized value at this node (plain Java types). Recursively normalizes Maps and Collections.
      Specified by:
      getNormalized in interface ConfigNode
      Returns:
      the normalized value, or null if not present