Package org.simpleframework.xml.strategy
Class ReadGraph
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap
-
- org.simpleframework.xml.strategy.ReadGraph
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map
class ReadGraph extends java.util.HashMap
TheReadGraph
object is used to build a graph of the objects that have been deserialized from the XML document. This is required so that cycles in the object graph can be recreated such that the deserialized object is an exact duplicate of the object that was serialized. Objects are stored in the graph using unique keys, which for this implementation are unique strings.- See Also:
WriteGraph
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
label
This is the label used to mark the type of an object.private java.lang.String
length
This is used to represent the length of array object values.private Loader
loader
This is the class loader that is used to load the types used.private java.lang.String
mark
This is the attribute used to mark the identity of an object.private java.lang.String
refer
This is the attribute used to refer to an existing instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Value
read(Type type, NodeMap node)
This is used to recover the object references from the document using the special attributes specified.private Value
readArray(Type type, java.lang.Class real, NodeMap node)
This is used to acquire theValue
which can be used to represent the deserialized value.private Value
readInstance(Type type, java.lang.Class real, NodeMap node)
This is used to recover the object references from the document using the special attributes specified.private Value
readReference(Type type, java.lang.Class real, NodeMap node)
This is used to recover the object references from the document using the special attributes specified.private Value
readValue(Type type, java.lang.Class real, NodeMap node)
This is used to acquire theValue
which can be used to represent the deserialized value.private Value
readValue(Type type, java.lang.Class real, NodeMap node, java.lang.String key)
This is used to acquire theValue
which can be used to represent the deserialized value.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Field Detail
-
loader
private final Loader loader
This is the class loader that is used to load the types used.
-
length
private final java.lang.String length
This is used to represent the length of array object values.
-
label
private final java.lang.String label
This is the label used to mark the type of an object.
-
mark
private final java.lang.String mark
This is the attribute used to mark the identity of an object.
-
refer
private final java.lang.String refer
This is the attribute used to refer to an existing instance.
-
-
Constructor Detail
-
ReadGraph
public ReadGraph(Contract contract, Loader loader)
Constructor for theReadGraph
object. This is used to create graphs that are used for reading objects from the XML document. The specified strategy is used to acquire the names of the special attributes used during the serialization.- Parameters:
contract
- this is the name scheme used by the strategyloader
- this is the class loader to used for the graph
-
-
Method Detail
-
read
public Value read(Type type, NodeMap node) throws java.lang.Exception
This is used to recover the object references from the document using the special attributes specified. This allows the element specified by theNodeMap
to be used to discover exactly which node in the object graph the element represents.- Parameters:
type
- the type of the field or method in the instancenode
- this is the XML element to be deserialized- Returns:
- this is used to return the type to acquire the value
- Throws:
java.lang.Exception
-
readInstance
private Value readInstance(Type type, java.lang.Class real, NodeMap node) throws java.lang.Exception
This is used to recover the object references from the document using the special attributes specified. This allows the element specified by theNodeMap
to be used to discover exactly which node in the object graph the element represents.- Parameters:
type
- the type of the field or method in the instancereal
- this is the overridden type from the XML elementnode
- this is the XML element to be deserialized- Returns:
- this is used to return the type to acquire the value
- Throws:
java.lang.Exception
-
readReference
private Value readReference(Type type, java.lang.Class real, NodeMap node) throws java.lang.Exception
This is used to recover the object references from the document using the special attributes specified. This allows the element specified by theNodeMap
to be used to discover exactly which node in the object graph the element represents.- Parameters:
type
- the type of the field or method in the instancereal
- this is the overridden type from the XML elementnode
- this is the XML element to be deserialized- Returns:
- this is used to return the type to acquire the value
- Throws:
java.lang.Exception
-
readValue
private Value readValue(Type type, java.lang.Class real, NodeMap node) throws java.lang.Exception
This is used to acquire theValue
which can be used to represent the deserialized value. The type create cab be added to the graph of created instances if the XML element has an identification attribute, this allows cycles to be completed.- Parameters:
type
- the type of the field or method in the instancereal
- this is the overridden type from the XML elementnode
- this is the XML element to be deserialized- Returns:
- this is used to return the type to acquire the value
- Throws:
java.lang.Exception
-
readValue
private Value readValue(Type type, java.lang.Class real, NodeMap node, java.lang.String key) throws java.lang.Exception
This is used to acquire theValue
which can be used to represent the deserialized value. The type create cab be added to the graph of created instances if the XML element has an identification attribute, this allows cycles to be completed.- Parameters:
type
- the type of the field or method in the instancereal
- this is the overridden type from the XML elementnode
- this is the XML element to be deserializedkey
- the key the instance is known as in the graph- Returns:
- this is used to return the type to acquire the value
- Throws:
java.lang.Exception
-
readArray
private Value readArray(Type type, java.lang.Class real, NodeMap node) throws java.lang.Exception
This is used to acquire theValue
which can be used to represent the deserialized value. The type create cab be added to the graph of created instances if the XML element has an identification attribute, this allows cycles to be completed.- Parameters:
type
- the type of the field or method in the instancereal
- this is the overridden type from the XML elementnode
- this is the XML element to be deserialized- Returns:
- this is used to return the type to acquire the value
- Throws:
java.lang.Exception
-
-