org.dasein.persist
Class Memento<K>

java.lang.Object
  extended by org.dasein.persist.Memento<K>

public class Memento<K>
extends Object

Provides state translation for persistent objects. By capturing the state information automatically in a hash map, this class decouples the implementation from its data structures in the persistent store.
Last modified: $Date: 2006/02/18 22:47:10 $

Version:
$Revision: 1.5 $
Author:
George Reese (http://george.reese.name)

Constructor Summary
Memento(K p)
          Constructs a memento for the specified persistent object.
 
Method Summary
 Map<String,Object> getState()
           
 void load(Map<String,Object> data)
          Loads the data values into the persistent object.
 void save(Map<String,Object> data)
          Saves the current state of the persistent object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Memento

public Memento(K p)
Constructs a memento for the specified persistent object.

Parameters:
p - the persistent object
Method Detail

getState

public Map<String,Object> getState()
Returns:
the state of this object as of its last call to save()

load

public void load(Map<String,Object> data)
          throws PersistenceException
Loads the data values into the persistent object.

Parameters:
data - the data to load into the persistent object
Throws:
PersistenceException - values from the data map could not be loaded into the persistent object

save

public void save(Map<String,Object> data)
          throws PersistenceException
Saves the current state of the persistent object.

Parameters:
data - values that should be used to override any current state
Throws:
PersistenceException - an error occurred reading values from the persistent object


Copyright © 2011 enStratus Networks LLC. All Rights Reserved.