Class ReadGraph

java.lang.Object
java.util.AbstractMap
java.util.HashMap
org.simpleframework.xml.strategy.ReadGraph
All Implemented Interfaces:
Serializable, Cloneable, Map

class ReadGraph extends HashMap
The ReadGraph 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:
  • Field Details

    • loader

      private final Loader loader
      This is the class loader that is used to load the types used.
    • length

      private final String length
      This is used to represent the length of array object values.
    • label

      private final String label
      This is the label used to mark the type of an object.
    • mark

      private final String mark
      This is the attribute used to mark the identity of an object.
    • refer

      private final String refer
      This is the attribute used to refer to an existing instance.
  • Constructor Details

    • ReadGraph

      public ReadGraph(Contract contract, Loader loader)
      Constructor for the ReadGraph 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 strategy
      loader - this is the class loader to used for the graph
  • Method Details

    • read

      public Value read(Type type, NodeMap node) throws Exception
      This is used to recover the object references from the document using the special attributes specified. This allows the element specified by the NodeMap 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 instance
      node - this is the XML element to be deserialized
      Returns:
      this is used to return the type to acquire the value
      Throws:
      Exception
    • readInstance

      private Value readInstance(Type type, Class real, NodeMap node) throws Exception
      This is used to recover the object references from the document using the special attributes specified. This allows the element specified by the NodeMap 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 instance
      real - this is the overridden type from the XML element
      node - this is the XML element to be deserialized
      Returns:
      this is used to return the type to acquire the value
      Throws:
      Exception
    • readReference

      private Value readReference(Type type, Class real, NodeMap node) throws Exception
      This is used to recover the object references from the document using the special attributes specified. This allows the element specified by the NodeMap 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 instance
      real - this is the overridden type from the XML element
      node - this is the XML element to be deserialized
      Returns:
      this is used to return the type to acquire the value
      Throws:
      Exception
    • readValue

      private Value readValue(Type type, Class real, NodeMap node) throws Exception
      This is used to acquire the Value 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 instance
      real - this is the overridden type from the XML element
      node - this is the XML element to be deserialized
      Returns:
      this is used to return the type to acquire the value
      Throws:
      Exception
    • readValue

      private Value readValue(Type type, Class real, NodeMap node, String key) throws Exception
      This is used to acquire the Value 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 instance
      real - this is the overridden type from the XML element
      node - this is the XML element to be deserialized
      key - the key the instance is known as in the graph
      Returns:
      this is used to return the type to acquire the value
      Throws:
      Exception
    • readArray

      private Value readArray(Type type, Class real, NodeMap node) throws Exception
      This is used to acquire the Value 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 instance
      real - this is the overridden type from the XML element
      node - this is the XML element to be deserialized
      Returns:
      this is used to return the type to acquire the value
      Throws:
      Exception