org.simpleframework.xml.stream
Interface NodeMap<T extends Node>

All Superinterfaces:
java.lang.Iterable<java.lang.String>

public interface NodeMap<T extends Node>
extends java.lang.Iterable<java.lang.String>

The NodeMap object represents a map of nodes that can be set as name value pairs. This typically represents the attributes that belong to an element and is used as an neutral way to access an element for either an input or output event.

Author:
Niall Gallagher
See Also:
Node

Method Summary
 T 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.
 T 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.
 T put(java.lang.String name, java.lang.String value)
          This is used to add a new Node to the map.
 T remove(java.lang.String name)
          This is used to remove the Node mapped to the given name.
 

Method Detail

getNode

T 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.

Returns:
this returns the node that this map represents

getName

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.

Returns:
this returns the name of the owning element

get

T 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 either an attribute or element. If no node is mapped to the specified name then this method will return null.

Parameters:
name - this is the name of the node to retrieve
Returns:
this will return the node mapped to the given name

remove

T 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 either an attribute or element. If no node is mapped to the specified name then this method will return null.

Parameters:
name - this is the name of the node to remove
Returns:
this will return the node mapped to the given name

iterator

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>
Returns:
this returns the names of the nodes in the map

put

T put(java.lang.String name,
      java.lang.String value)
This is used to add a new Node to the map. The type of node that is created an added is left up to the map implementation. Once a node is created with the name value pair it can be retrieved and used.

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