com.ashridgetech.prevdb.client
Class FieldChangeMap

java.lang.Object
  |
  +--com.ashridgetech.prevdb.client.FieldChangeMap

public final class FieldChangeMap
extends Object

A mapping from a set of a persistent fields of one Persistent class to their values and their old values. Holds two FieldMaps.

Version:
1.0
Author:
paulb

Constructor Summary
FieldChangeMap(Class persistentClass, Object oid)
          Creates a new FieldChangeMap for a particular persistent class and oid.
FieldChangeMap(Persistent obj)
          Creates a new FieldChangeMap for a particular persistent object.
 
Method Summary
 Set getFields()
          Get the set of fields in this FieldChangeMap
 FieldMap getNewFieldMap()
          Get the FieldMap of new values.
 Object getNewFieldValue(PersistentField field)
          Get the new value of a field that is known to be held in this FieldChangeMap
 Object getOid()
          Get the oid
 FieldMap getOldFieldMap()
          Get the FieldMap of old values.
 Object getOldFieldValue(PersistentField field)
          Get the old value of a field that is known to be held in this FieldChangeMap
 Class getPersistentClass()
          Get the class to which this FieldChangeMap belongs
 boolean hasFieldValue(PersistentField field)
          Indicate whether this FieldChangeMap has a value for a particular field
 boolean isMapFor(Persistent obj)
          Show whether this FieldChangeMap holds field values for a given Persistent object.
 void setFieldValues(PersistentField field, Object oldValue, Object newValue)
          Set a field value in this FieldChangeMap
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldChangeMap

public FieldChangeMap(Class persistentClass,
                      Object oid)
Creates a new FieldChangeMap for a particular persistent class and oid.

Parameters:
persistentClass - the class of object for which this FieldChangeMap stores fields and old and new values
oid - the object id of the Persistent to which the field values in this FieldMap apply

FieldChangeMap

public FieldChangeMap(Persistent obj)
Creates a new FieldChangeMap for a particular persistent object.

Parameters:
obj - the object for which this FieldChangeMap stores field changes
Method Detail

getPersistentClass

public Class getPersistentClass()
Get the class to which this FieldChangeMap belongs

Returns:
the class to which this FieldChangeMap belongs

getOid

public Object getOid()
Get the oid

Returns:
the object id of the Persistent to which the field values in this FieldMap apply

isMapFor

public boolean isMapFor(Persistent obj)
Show whether this FieldChangeMap holds field values for a given Persistent object.

Parameters:
obj - the persistent object to check

getOldFieldValue

public Object getOldFieldValue(PersistentField field)
Get the old value of a field that is known to be held in this FieldChangeMap

Parameters:
field - the field for which a value is required
Returns:
the old value of the field
See Also:
hasFieldValue(com.ashridgetech.prevdb.client.PersistentField)

getNewFieldValue

public Object getNewFieldValue(PersistentField field)
Get the new value of a field that is known to be held in this FieldChangeMap

Parameters:
field - the field for which a value is required
Returns:
the old value of the field
See Also:
hasFieldValue(com.ashridgetech.prevdb.client.PersistentField)

setFieldValues

public void setFieldValues(PersistentField field,
                           Object oldValue,
                           Object newValue)
Set a field value in this FieldChangeMap

Parameters:
field - the field for which a value is to be set
Returns:
the name of the field
See Also:
#getOldFieldValue

getOldFieldMap

public FieldMap getOldFieldMap()
Get the FieldMap of old values. Note: the FieldMap returned is not copied, so it should not be modified by the caller

Returns:
the old values

getNewFieldMap

public FieldMap getNewFieldMap()
Get the FieldMap of new values. Note: the FieldMap returned is not copied, so it should not be modified by the caller

Returns:
the new values

hasFieldValue

public boolean hasFieldValue(PersistentField field)
Indicate whether this FieldChangeMap has a value for a particular field

Parameters:
field - the field for which a value is required
Returns:
true if this FieldChangeMap has a value for field

getFields

public Set getFields()
Get the set of fields in this FieldChangeMap

Returns:
the unmodifiable set of PersistentField objects

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.