Class InputNodeMap

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

    class InputNodeMap
    extends java.util.LinkedHashMap<java.lang.String,​InputNode>
    implements NodeMap<InputNode>
    The InputNodeMap object represents a map to contain attributes used by an input node. This can be used as an empty node map, it can be used to extract its values from a start element. This creates InputAttribute objects for each node added to the map, these can then be used by an element input node to represent attributes as input nodes.
    • 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 InputNode source
      This is the source node that this node map belongs to.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void build​(EventNode element)
      This is used to insert all attributes belonging to the start element to the map.
      InputNode 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.
      InputNode 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 NodeMap.
      InputNode put​(java.lang.String name, java.lang.String value)
      This is used to add a new InputAttribute node to the map.
      InputNode 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 InputNode source
        This is the source node that this node map belongs to.
    • Constructor Detail

      • InputNodeMap

        protected InputNodeMap​(InputNode source)
        Constructor for the InputNodeMap object. This is used to create an empty input node map, which will create InputAttribute object for each inserted node.
        Parameters:
        source - this is the node this node map belongs to
      • InputNodeMap

        public InputNodeMap​(InputNode source,
                            EventNode element)
        Constructor for the InputNodeMap object. This is used to create an input node map, which will be populated with the attributes from the StartElement that is specified.
        Parameters:
        source - this is the node this node map belongs to
        element - the element to populate the node map with
    • Method Detail

      • build

        private void build​(EventNode element)
        This is used to insert all attributes belonging to the start element to the map. All attributes acquired from the element are converted into InputAttribute objects so that they can be used as input nodes by an input node.
        Parameters:
        element - the element to acquire attributes from
      • getNode

        public InputNode 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<InputNode>
        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<InputNode>
        Returns:
        this returns the name of the owning element
      • put

        public InputNode put​(java.lang.String name,
                             java.lang.String value)
        This is used to add a new InputAttribute node to the map. The created node can be used by an input node to to represent the attribute as another input node. Once the node is created it can be acquired using the specified name.
        Specified by:
        put in interface NodeMap<InputNode>
        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 returns the node that has just been added
      • remove

        public InputNode 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 return a null value.
        Specified by:
        remove in interface NodeMap<InputNode>
        Parameters:
        name - this is the name of the node to remove
        Returns:
        this will return the node mapped to the given name
      • get

        public InputNode 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 attribute. If no node is mapped to the specified name then this method will return a null value.
        Specified by:
        get in interface NodeMap<InputNode>
        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 NodeMap. 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<InputNode>
        Returns:
        this returns the names of the nodes in the map