Class LeafNode

  • All Implemented Interfaces:
    ConfigNode

    public final class LeafNode
    extends java.lang.Object
    implements ConfigNode
    leaf node that holds a value.
    • Constructor Summary

      Constructors 
      Constructor Description
      LeafNode​(java.lang.String value)
      Construct a leaf node that holds a single value.
    • 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.
      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

      • LeafNode

        public LeafNode​(java.lang.String value)
        Construct a leaf node that holds a single value.
        Parameters:
        value - string value for current leaf node
    • 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
      • 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