Package org.simpleframework.xml.strategy
Class WriteState
- java.lang.Object
-
- org.simpleframework.xml.util.WeakCache<WriteGraph>
-
- org.simpleframework.xml.strategy.WriteState
-
- All Implemented Interfaces:
Cache<WriteGraph>
class WriteState extends WeakCache<WriteGraph>
TheWriteState
object is used to store all graphs that are currently been written 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 write 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:
WriteGraph
-
-
Constructor Summary
Constructors Constructor Description WriteState(Contract contract)
Constructor for theWriteState
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WriteGraph
find(java.lang.Object map)
This will acquire the graph using the specified session map.
-
-
-
Field Detail
-
contract
private Contract contract
This is the contract that specifies the attributes to use.
-
-
Constructor Detail
-
WriteState
public WriteState(Contract contract)
Constructor for theWriteState
object. This is used to create graphs that are used for writing objects to the 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
-
-
Method Detail
-
find
public WriteGraph find(java.lang.Object map)
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 writing the XML document
-
-