Class InputNodeMap

All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Map<String,InputNode>, SequencedMap<String,InputNode>, NodeMap<InputNode>

class InputNodeMap extends LinkedHashMap<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.
  • Field Details

    • source

      private final InputNode source
      This is the source node that this node map belongs to.
  • Constructor Details

    • 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 Details

    • 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 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(String name, 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(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(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 Iterator<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 Iterable<String>
      Specified by:
      iterator in interface NodeMap<InputNode>
      Returns:
      this returns the names of the nodes in the map