Class ArrayNode

  • All Implemented Interfaces:
    ConfigNode

    public final class ArrayNode
    extends java.lang.Object
    implements ConfigNode
    Array config node that holds a list of configs.
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayNode​(java.util.List<ConfigNode> values)
      Construct an Array node by providing a list of nodes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.util.List<ConfigNode> getArray()
      get the underlying array for the node.
      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

      • ArrayNode

        public ArrayNode​(java.util.List<ConfigNode> values)
        Construct an Array node by providing a list of nodes.
        Parameters:
        values - list of nodes
    • 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
      • getArray

        public java.util.List<ConfigNode> getArray()
        get the underlying array for the node.
        Returns:
        the underlying array
      • 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