Class OutputNodeMap

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>, java.util.Map<java.lang.String,​OutputNode>, NodeMap<OutputNode>

    class OutputNodeMap
    extends java.util.LinkedHashMap<java.lang.String,​OutputNode>
    implements NodeMap<OutputNode>
    The OutputNodeMap is used to collect attribute nodes for an output node. This will create a generic node to add to the map. The nodes created will be used by the output node to write attributes for an element.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private OutputNode source
      This is the source node that this node map belongs to.
    • Constructor Summary

      Constructors 
      Constructor Description
      OutputNodeMap​(OutputNode source)
      Constructor for the OutputNodeMap object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OutputNode get​(java.lang.String name)
      This is used to acquire the Node mapped to the given name.
      java.lang.String getName()
      This is used to get the name of the element that owns the nodes for the specified map.
      OutputNode getNode()
      This is used to acquire the actual node this map represents.
      java.util.Iterator<java.lang.String> iterator()
      This returns an iterator for the names of all the nodes in this OutputNodeMap.
      OutputNode put​(java.lang.String name, java.lang.String value)
      This is used to add a new Node to the map.
      OutputNode remove​(java.lang.String name)
      This is used to remove the Node mapped to the given name.
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
    • Field Detail

      • source

        private final OutputNode source
        This is the source node that this node map belongs to.
    • Constructor Detail

      • OutputNodeMap

        public OutputNodeMap​(OutputNode source)
        Constructor for the OutputNodeMap object. This is used to create a node map that is used to create and collect nodes, which will be used as attributes for an output element.
    • Method Detail

      • getNode

        public OutputNode getNode()
        This is used to acquire the actual node this map represents. The source node provides further details on the context of the node, such as the parent name, the namespace, and even the value in the node. Care should be taken when using this.
        Specified by:
        getNode in interface NodeMap<OutputNode>
        Returns:
        this returns the node that this map represents
      • getName

        public java.lang.String getName()
        This is used to get the name of the element that owns the nodes for the specified map. This can be used to determine which element the node map belongs to.
        Specified by:
        getName in interface NodeMap<OutputNode>
        Returns:
        this returns the name of the owning element
      • put

        public OutputNode put​(java.lang.String name,
                              java.lang.String value)
        This is used to add a new Node to the map. The node that is created is a simple name value pair. Once the node is created it can be retrieved by its given name.
        Specified by:
        put in interface NodeMap<OutputNode>
        Parameters:
        name - this is the name of the node to be created
        value - this is the value to be given to the node
        Returns:
        this is the node that has been added to the map
      • remove

        public OutputNode remove​(java.lang.String name)
        This is used to remove the Node mapped to the given name. This returns a name value pair that represents an attribute. If no node is mapped to the specified name then this method will a return null value.
        Specified by:
        remove in interface NodeMap<OutputNode>
        Parameters:
        name - this is the name of the node to remove
        Returns:
        this will return the node mapped to the given name
      • get

        public OutputNode get​(java.lang.String name)
        This is used to acquire the Node mapped to the given name. This returns a name value pair that represents an element. If no node is mapped to the specified name then this method will return a null value.
        Specified by:
        get in interface NodeMap<OutputNode>
        Parameters:
        name - this is the name of the node to retrieve
        Returns:
        this will return the node mapped to the given name
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        This returns an iterator for the names of all the nodes in this OutputNodeMap. This allows the names to be iterated within a for each loop in order to extract nodes.
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
        Specified by:
        iterator in interface NodeMap<OutputNode>
        Returns:
        this returns the names of the nodes in the map