- java.lang.Object
-
- org.github.gestalt.config.node.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 booleanequals(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.NodeTypegetNodeType()Get the node type.java.util.Optional<java.lang.String>getValue()get the optional value for a leaf node, empty otherwise.inthashCode()intsize()side of the node, or 1 if a leaf.java.lang.StringtoString()
-
-
-
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
-
getNodeType
public NodeType getNodeType()
Description copied from interface:ConfigNodeGet the node type.- Specified by:
getNodeTypein interfaceConfigNode- Returns:
- the node type
-
getValue
public java.util.Optional<java.lang.String> getValue()
Description copied from interface:ConfigNodeget the optional value for a leaf node, empty otherwise.- Specified by:
getValuein interfaceConfigNode- Returns:
- optional value
-
getIndex
public java.util.Optional<ConfigNode> getIndex(int index)
Description copied from interface:ConfigNodeGet the optional config node by index for arrays, empty otherwise.- Specified by:
getIndexin interfaceConfigNode- 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:ConfigNodeGet the optional config node by key for objects, empty otherwise.- Specified by:
getKeyin interfaceConfigNode- Parameters:
key- for node we are looking for.- Returns:
- optional config node
-
size
public int size()
Description copied from interface:ConfigNodeside of the node, or 1 if a leaf.- Specified by:
sizein interfaceConfigNode- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-