|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groiss.store.PersistentObject
public abstract class PersistentObject
This is a default implementation of the Persistent
interface. All methods apart from Persistent.getTableName()
are implemented with default behaviour.
This abstract class also implements the KeyValuePair
interface. So persistent objects become key value pairs, where the object's
OID is the key and the object's String
representation is the
value.
Field Summary | |
---|---|
protected boolean |
filled
|
protected long |
oid
|
Constructor Summary | |
---|---|
PersistentObject()
|
Method Summary | |
---|---|
java.lang.Object |
clone()
|
java.util.List<java.lang.reflect.Field> |
dbFields()
Returns the persistent fields of this object in a List
containing java.lang.reflect.Field objects. |
boolean |
equals(java.lang.Object o)
Compares two persistent objects and returns true if they
are equal (i.e., they must have the same OID and the same class). |
java.lang.Object |
getKey()
Returns the key (OID) of this KeyValuePair . |
long |
getOid()
Getter method for the persistent object's OID. |
Store |
getStore()
Returns the Store object which is responsible for storing this
persistence object. |
java.lang.Object |
getValue()
Returns the value ( String representation) of this
KeyValuePair . |
int |
hashCode()
Returns a hash code for this persistent object. |
boolean |
isFilled()
With this method you check if this persistent object is filled with persistent data or not. |
void |
onDelete()
This method is called before the persistent object is deleted. |
void |
onInsert()
This method is called before the persistent object is inserted in the store. |
void |
onRead()
This method is called after the persistent object has been read. |
void |
onUpdate()
This method is called before the persistent object is updated to the store (the existing object in the store will be overwritten with the values of this object). |
void |
setFilled(boolean f)
This method can change the filled status of this persistent object. |
void |
setOid(long oid)
Setter method for the persistent object's OID. |
void |
setStore(Store store)
With this method you can change the Store of this persistent object. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.groiss.store.Persistent |
---|
getTableName |
Field Detail |
---|
protected long oid
protected boolean filled
Constructor Detail |
---|
public PersistentObject()
Method Detail |
---|
public long getOid()
Persistent
getOid
in interface Persistent
public void setOid(long oid)
Persistent
setOid
in interface Persistent
oid
- The new OID for the object.public void setFilled(boolean f)
Persistent
Persistent.isFilled()
for more details.
setFilled
in interface Persistent
f
- The new value for the filled status.public boolean isFilled()
Persistent
Store
to fill it.
isFilled
in interface Persistent
true
if the object is filled with values, or
false
if the object is empty (only OID is set).public Store getStore()
Store
object which is responsible for storing this
persistence object.
getStore
in interface Persistent
Store
of this persistent object.public void setStore(Store store)
Persistent
Store
of this persistent object.
Usually objects are stored in the system's database and you will never need
to set the Store
manually.
setStore
in interface Persistent
store
- The new Store
that will be set for this persistent object.public java.util.List<java.lang.reflect.Field> dbFields()
List
containing java.lang.reflect.Field
objects.
dbFields
in interface Persistent
List
containing the persistent fields of this
persistent object. The List
must contain the fields
as java.lang.reflect.Field
objects.public void onInsert()
Persistent
onInsert
in interface Persistent
public void onUpdate()
Persistent
onUpdate
in interface Persistent
public void onDelete()
Persistent
Store.delete(Class, String, Object[])
and
Store.delete(String, String, Object[])
methods do NOT call Persistent.onDelete()
.
onDelete
in interface Persistent
public void onRead()
Persistent
onRead
in interface Persistent
public boolean equals(java.lang.Object o)
true
if they
are equal (i.e., they must have the same OID and the same class).
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object getValue()
String
representation) of this
KeyValuePair
.
getValue
in interface KeyValuePair<java.lang.Object,java.lang.Object>
public java.lang.Object getKey()
KeyValuePair
.
getKey
in interface KeyValuePair<java.lang.Object,java.lang.Object>
public java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |