com.ashridgetech.prevdb.client
Class FieldMap

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

public final class FieldMap
extends Object

A mapping from a set of a persistent fields of one Persistent class to their values, in one Persistent object. Can be used with the Persistent interface to get or set fields. Field values cannot be removed once set, but they can be set more than once (although this is not recommended). The fields are stored in the order in which they are set by calls to setFieldValue(com.ashridgetech.prevdb.client.PersistentField, java.lang.Object).

Version:
1.0
Author:
paulb

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

Constructor Detail

FieldMap

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

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

FieldMap

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

Parameters:
obj - the object for which this FieldMap stores fields and values
Method Detail

getPersistentClass

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

Returns:
the class to which this FieldMap 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 FieldMap holds field values for a given Persistent object.

Parameters:
obj - the persistent object to check

getFieldValue

public Object getFieldValue(PersistentField field)
Get a field value that is known to be held in this FieldMap

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

setFieldValue

public void setFieldValue(PersistentField field,
                          Object value)
Set a field value in this FieldMap

Parameters:
field - the field for which a value is to be set
Returns:
the name of the field
See Also:
getFieldValue(com.ashridgetech.prevdb.client.PersistentField)

hasFieldValue

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

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

getFields

public Set getFields()
Get the set of fields in this FieldMap, in the order in which they were set.

Returns:
the unmodifiable set of PersistentField objects

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.