hu.netmind.beankeeper.event
Class ModifyObjectEvent

java.lang.Object
  extended by hu.netmind.beankeeper.event.ObjectEvent
      extended by hu.netmind.beankeeper.event.ModifyObjectEvent
All Implemented Interfaces:
PersistenceEvent

public class ModifyObjectEvent
extends ObjectEvent

This event is generated if an object's attributes changed.


Constructor Summary
ModifyObjectEvent(StoreContext context, java.util.Map originalAttributes, TimeControl timeControl, java.lang.Object object)
           
 
Method Summary
 java.lang.Object getOriginalObject()
          Get the original object before the change occured.
 boolean isOriginalValue(java.lang.String attributeName, java.lang.Object value)
          Determine whether an original attribute was equals to the given value.
 
Methods inherited from class hu.netmind.beankeeper.event.ObjectEvent
getObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModifyObjectEvent

public ModifyObjectEvent(StoreContext context,
                         java.util.Map originalAttributes,
                         TimeControl timeControl,
                         java.lang.Object object)
Method Detail

isOriginalValue

public boolean isOriginalValue(java.lang.String attributeName,
                               java.lang.Object value)
Determine whether an original attribute was equals to the given value. If the value is not a primitive type, it is considered the old value if they have the same identity. This method is inexpensive unlike getOriginalObject(), so use this if possible.

Parameters:
attributeName - The attribute to check, case insensitive.
value - The value.
Throws:
StoreException - If container types are tried to be compared.

getOriginalObject

public java.lang.Object getOriginalObject()
Get the original object before the change occured. Note, that this method selects the object from database, so this should be considered an expensive operation. Use with caution.