barsuift.simLife
Interface Persistent<E extends State>

Type Parameters:
E - the class representing the State that will be persisted
All Known Implementing Classes:
SimLifeCalendar

public interface Persistent<E extends State>

This interface represents a persistent object.

The object is persisted using its State representation, by using the #getClass() method.

This interface also provides a synchronize() method, to synchronize the State instance with the current state of the object to persist.


Method Summary
 E getState()
          Gets the state of the persistent object.
 void synchronize()
          Synchronizes the State instance with the current object state.
 

Method Detail

getState

E getState()
Gets the state of the persistent object.

Implementing class should consider systematically calling the synchronize() method before returning the actual state. It is not up to clients to synchronize the object themselves.

Returns:
the object state

synchronize

void synchronize()
Synchronizes the State instance with the current object state.

It is not up to clients to synchronize the object themselves. Instead, this method should be called by the getState() method.

On the other hand, this method is provided to allow aggregation classes to synchronize their aggregated instances without requiring the call to the getState() method.



Copyright © 2010. All Rights Reserved.