Package org.simpleframework.xml.stream
Class InputNodeMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<java.lang.String,InputNode>
-
- org.simpleframework.xml.stream.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>
TheInputNodeMapobject 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 createsInputAttributeobjects for each node added to the map, these can then be used by an element input node to represent attributes as input nodes.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInputNodeMap(InputNode source)Constructor for theInputNodeMapobject.InputNodeMap(InputNode source, EventNode element)Constructor for theInputNodeMapobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbuild(EventNode element)This is used to insert all attributes belonging to the start element to the map.InputNodeget(java.lang.String name)This is used to acquire theNodemapped to the given name.java.lang.StringgetName()This is used to get the name of the element that owns the nodes for the specified map.InputNodegetNode()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 thisNodeMap.InputNodeput(java.lang.String name, java.lang.String value)This is used to add a newInputAttributenode to the map.InputNoderemove(java.lang.String name)This is used to remove theNodemapped 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
-
-
-
-
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 theInputNodeMapobject. This is used to create an empty input node map, which will createInputAttributeobject for each inserted node.- Parameters:
source- this is the node this node map belongs to
-
InputNodeMap
public InputNodeMap(InputNode source, EventNode element)
Constructor for theInputNodeMapobject. This is used to create an input node map, which will be populated with the attributes from theStartElementthat is specified.- Parameters:
source- this is the node this node map belongs toelement- 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 intoInputAttributeobjects 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.
-
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.
-
put
public InputNode put(java.lang.String name, java.lang.String value)
This is used to add a newInputAttributenode 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.
-
remove
public InputNode remove(java.lang.String name)
This is used to remove theNodemapped 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.
-
get
public InputNode get(java.lang.String name)
This is used to acquire theNodemapped 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.
-
iterator
public java.util.Iterator<java.lang.String> iterator()
This returns an iterator for the names of all the nodes in thisNodeMap. This allows the names to be iterated within a for each loop in order to extract nodes.
-
-