|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ashridgetech.prevdb.client.AbstractPersistentObject
A convenient base class for classes that want to implement Persistent
.
Holds an oid. Cooperates with its PersistentManager
.
Field Summary | |
Object |
oid
|
static PersistentField |
OID
|
protected static PersistentField[] |
PERSISTENT_FIELDS
|
Constructor Summary | |
protected |
AbstractPersistentObject(PersistentManager manager)
|
protected |
AbstractPersistentObject(PersistentManager manager,
Object oid)
|
protected |
AbstractPersistentObject(PrevDb prevDb,
Class thisClass)
|
Method Summary | |
Object |
getField(PersistentField field)
Get the value of a single field. |
FieldMap |
getFields()
Get a map of all the persistent fields in this object. |
protected Object |
getJavaField(Field javaField)
Get the value of a Java field. |
PersistentManager |
getManager()
Get the PersistentManager for this class |
Object |
getOid()
Get the oid of this object. |
static PersistentField |
getPersistentField(PersistentField[] persistentFields,
String name)
Get a PersistentField from an array by name. |
protected PersistentField[] |
getPersistentFields()
Provide an array of PersistentField s for this object. |
protected int |
notifyUpdate(PersistentField field,
int oldValue,
int newValue)
|
protected Object |
notifyUpdate(PersistentField field,
Object oldValue,
Object newValue)
Convenience method to allow a subclass setter method to call PersistentManager.notifyFieldUpdate(com.ashridgetech.prevdb.client.Persistent, com.ashridgetech.prevdb.client.PersistentField, java.lang.Object, java.lang.Object) . |
protected String |
notifyUpdate(PersistentField field,
String oldValue,
String newValue)
|
void |
setField(PersistentField field,
Object value)
Set the value of a single field. |
void |
setFields(FieldMap fields)
Set some or all of the fields in this object. |
protected void |
setJavaField(Field javaField,
Object value)
Set the value of a Java field. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public Object oid
public static final PersistentField OID
protected static final PersistentField[] PERSISTENT_FIELDS
Constructor Detail |
protected AbstractPersistentObject(PersistentManager manager, Object oid)
protected AbstractPersistentObject(PersistentManager manager)
protected AbstractPersistentObject(PrevDb prevDb, Class thisClass)
Method Detail |
public Object getOid()
Persistent
getOid
in interface Persistent
public PersistentManager getManager()
getManager
in interface Persistent
public FieldMap getFields()
Persistent
getFields
in interface Persistent
public void setFields(FieldMap fields)
Persistent
setFields
in interface Persistent
fields
- the fields to setpublic Object getField(PersistentField field)
Persistent
getField
in interface Persistent
field
- the PersistentField
whose value is required
public void setField(PersistentField field, Object value)
Persistent
setField
in interface Persistent
field
- the PersistentField
whose value is to be setvalue
- the field valueprotected Object notifyUpdate(PersistentField field, Object oldValue, Object newValue)
PersistentManager.notifyFieldUpdate(com.ashridgetech.prevdb.client.Persistent, com.ashridgetech.prevdb.client.PersistentField, java.lang.Object, java.lang.Object)
. Returns the
new value so that the notification and assignment can be done
in one line eg
public void setBalance( BigDecimal balance ) { this.balance = noyifyUpdate( this.balance, balance ); }
field
- the persistent field being updatedoldValue
- the existing value of the fieldnewValue
- the new value of the field
protected String notifyUpdate(PersistentField field, String oldValue, String newValue)
notifyUpdate( PersistentField, Object, Object )
protected int notifyUpdate(PersistentField field, int oldValue, int newValue)
notifyUpdate( PersistentField, Object, Object )
protected Object getJavaField(Field javaField) throws IllegalAccessException
return javaField.get( this );
javaField
- the Field
to get the value of
IllegalAccessException
protected void setJavaField(Field javaField, Object value) throws IllegalAccessException
javaField.set( this, value );
javaField
- the Field
to set the value ofvalue
- the value to set
IllegalAccessException
protected PersistentField[] getPersistentFields()
PersistentField
s for this object.
Must include the persistent fields of the superclass, if any
PersistentField
spublic static PersistentField getPersistentField(PersistentField[] persistentFields, String name)
PersistentField
from an array by name.
persistentFields
- the fields to select fromname
- the name of the field
IllegalArgumentException
- if no field called name
exists in persistentFields
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |