Class ReadState

  • All Implemented Interfaces:
    Cache<ReadGraph>

    class ReadState
    extends WeakCache<ReadGraph>
    The ReadState object is used to store all graphs that are currently been read with a given cycle strategy. The goal of this object is to act as a temporary store for graphs such that when the persistence session has completed the read graph will be garbage collected. This ensures that there are no lingering object reference that could cause a memory leak. If a graph for the given session key does not exist then a new one is created.
    See Also:
    WeakCache
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Contract contract
      This is the contract that specifies the attributes to use.
      private Loader loader
      This is the loader used to load the classes for this.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReadState​(Contract contract)
      Constructor for the ReadState object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private ReadGraph create​(java.lang.Object map)
      This will acquire the graph using the specified session map.
      ReadGraph find​(java.lang.Object map)
      This will acquire the graph using the specified session map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • contract

        private final Contract contract
        This is the contract that specifies the attributes to use.
      • loader

        private final Loader loader
        This is the loader used to load the classes for this.
    • Constructor Detail

      • ReadState

        public ReadState​(Contract contract)
        Constructor for the ReadState 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 name scheme used by the cycle strategy
    • Method Detail

      • find

        public ReadGraph find​(java.lang.Object map)
                       throws java.lang.Exception
        This will acquire the graph using the specified session map. If a graph does not already exist mapped to the given session then one will be created and stored with the key provided. Once the specified key is garbage collected then so is the graph object.
        Parameters:
        map - this is typically the persistence session map used
        Returns:
        returns a graph used for reading the XML document
        Throws:
        java.lang.Exception
      • create

        private ReadGraph create​(java.lang.Object map)
                          throws java.lang.Exception
        This will acquire the graph using the specified session map. If a graph does not already exist mapped to the given session then one will be created and stored with the key provided. Once the specified key is garbage collected then so is the graph object.
        Parameters:
        map - this is typically the persistence session map used
        Returns:
        returns a graph used for reading the XML document
        Throws:
        java.lang.Exception