org.dellroad.stuff.pobj
Class PersistentObjectEvent<T>

java.lang.Object
  extended by java.util.EventObject
      extended by org.dellroad.stuff.pobj.PersistentObjectEvent<T>
Type Parameters:
T - type of the root persistent object
All Implemented Interfaces:
Serializable

public class PersistentObjectEvent<T>
extends EventObject

Notification event emitted by a PersistentObject to listeners whenever there is an update to the root object.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
PersistentObjectEvent(PersistentObject<T> persistentObject, long version, T oldRoot, T newRoot)
           
 
Method Summary
 T getNewRoot()
          Get the new root after to the update.
 T getOldRoot()
          Get the old root prior to the update.
 PersistentObject<T> getSource()
          Get the PersistentObject that originated this event.
 long getVersion()
          Get the version that this event is associated with.
 
Methods inherited from class java.util.EventObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistentObjectEvent

public PersistentObjectEvent(PersistentObject<T> persistentObject,
                             long version,
                             T oldRoot,
                             T newRoot)
Method Detail

getSource

public PersistentObject<T> getSource()
Get the PersistentObject that originated this event.

Overrides:
getSource in class EventObject

getVersion

public long getVersion()
Get the version that this event is associated with. This will be the version of the new root.

The PersistentObject class always delivers notifications in order, so this number should always increase over time.


getOldRoot

public T getOldRoot()
Get the old root prior to the update.

The caller must not modify the returned object, as it is shared among all listeners.


getNewRoot

public T getNewRoot()
Get the new root after to the update.

The caller must not modify the returned object, as it is shared among all listeners.