Class MapNode

  • All Implemented Interfaces:
    ConfigNode

    public final class MapNode
    extends java.lang.Object
    implements ConfigNode
    Map node holds a map of config nodes we can get by key.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapNode​(java.util.Map<java.lang.String,​ConfigNode> mapNode)
      Construct the MapNode by providing a map for the current tree.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.util.Optional<ConfigNode> getIndex​(int index)
      Get the optional config node by index for arrays, empty otherwise.
      java.util.Optional<ConfigNode> getKey​(java.lang.String key)
      Get the optional config node by key for objects, empty otherwise.
      java.util.Map<java.lang.String,​ConfigNode> getMapNode()
      Get the map node.
      NodeType getNodeType()
      Get the node type.
      java.util.Optional<java.lang.String> getValue()
      get the optional value for a leaf node, empty otherwise.
      int hashCode()  
      int size()
      side of the node, or 1 if a leaf.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MapNode

        public MapNode​(java.util.Map<java.lang.String,​ConfigNode> mapNode)
        Construct the MapNode by providing a map for the current tree.
        Parameters:
        mapNode - map for the current tree
    • Method Detail

      • getValue

        public java.util.Optional<java.lang.String> getValue()
        Description copied from interface: ConfigNode
        get the optional value for a leaf node, empty otherwise.
        Specified by:
        getValue in interface ConfigNode
        Returns:
        optional value
      • getIndex

        public java.util.Optional<ConfigNode> getIndex​(int index)
        Description copied from interface: ConfigNode
        Get the optional config node by index for arrays, empty otherwise.
        Specified by:
        getIndex in interface ConfigNode
        Parameters:
        index - for arrays the index we want
        Returns:
        optional config
      • getKey

        public java.util.Optional<ConfigNode> getKey​(java.lang.String key)
        Description copied from interface: ConfigNode
        Get the optional config node by key for objects, empty otherwise.
        Specified by:
        getKey in interface ConfigNode
        Parameters:
        key - for node we are looking for.
        Returns:
        optional config node
      • size

        public int size()
        Description copied from interface: ConfigNode
        side of the node, or 1 if a leaf.
        Specified by:
        size in interface ConfigNode
        Returns:
        side of the node
      • getMapNode

        public java.util.Map<java.lang.String,​ConfigNode> getMapNode()
        Get the map node.
        Returns:
        Get the map node
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object