com.objectwave.transactionalSupport
Class ObjectModified

java.lang.Object
  |
  +--com.objectwave.transactionalSupport.ObjectModified
All Implemented Interfaces:
ObjectChangeRequest
Direct Known Subclasses:
NullChange

public class ObjectModified
extends java.lang.Object
implements ObjectChangeRequest

The details of a change to a particular object. Every change will create an ObjectModified object. There will be only one ObjectModified instance per attribute per transaction. Only 1 thread will be calling get and set with this class.

Version:
2.4

Nested Class Summary
static class ObjectModified.Test
           
 
Constructor Summary
protected ObjectModified()
          Store the changes to the domain object.
 
Method Summary
protected  void clean()
           
 void commit(boolean force)
          Place the new value into the domain object.
 java.lang.Object currentValue()
           
 java.lang.reflect.Field getAccessor()
           
protected  void initObjectModified(java.lang.reflect.Field adapt, TransactionalObjectIF theInstance, java.lang.Object newVal, java.lang.Object old)
          Set the changed values.
 boolean isCollection()
          Is this field representing an Array, Hashtable, or a Vector?
 java.lang.Object originalValue()
           
 boolean returnThis()
          A workaround for a small problem
 void rollback()
          Change the domain object to contain the 'old' value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectModified

protected ObjectModified()
Store the changes to the domain object.

Method Detail

returnThis

public boolean returnThis()
A workaround for a small problem


clean

protected void clean()

initObjectModified

protected void initObjectModified(java.lang.reflect.Field adapt,
                                  TransactionalObjectIF theInstance,
                                  java.lang.Object newVal,
                                  java.lang.Object old)
Set the changed values.


commit

public void commit(boolean force)
            throws UpdateException
Place the new value into the domain object. Prior to updating the domain object we validate that no one else has updated this particular field in the domain object. If someone has, an UpdateException will be thrown.

Specified by:
commit in interface ObjectChangeRequest
Parameters:
force - Override the default behavior of checking if the object has changed.
Throws:
UpdateException

currentValue

public java.lang.Object currentValue()
Specified by:
currentValue in interface ObjectChangeRequest
Returns:
Object The 'current' value of the Object. This is NOT actually what value is found in the domain object. Rather what the value will be when the change is committed.

getAccessor

public final java.lang.reflect.Field getAccessor()
Returns:
java.lang.Field object in which this change occurred.

isCollection

public boolean isCollection()
Is this field representing an Array, Hashtable, or a Vector?

Specified by:
isCollection in interface ObjectChangeRequest
Returns:
The Collection value

originalValue

public java.lang.Object originalValue()
Specified by:
originalValue in interface ObjectChangeRequest
Returns:
Object value found in the domain object when this change occurred.

rollback

public void rollback()
Change the domain object to contain the 'old' value. There is nothing to rollback if I did not commit.

Specified by:
rollback in interface ObjectChangeRequest