public abstract class JDOObject extends Object implements Cloneable, Comparable<JDOObject>, Serializable, javax.jdo.InstanceCallbacks
JDO Object
classes will be derived. Provides default implementations for
common methods.
Copyright 2006, Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected int |
hash
The integer that represents the hash code for this object.
|
protected static int |
HASH
The default value to use for
hash. |
protected static Logger |
logger
The logger to use to log errors or messages to.
|
protected StartLetter |
startLetter
The start letter for the primary string identifier for the object.
|
| Modifier | Constructor and Description |
|---|---|
protected |
JDOObject()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates and returns a copy of this object.
|
int |
compareTo(JDOObject object)
Compares this object with the specified object for order.
|
protected static com.thoughtworks.xstream.XStream |
createXStream()
Return the utility used to convert the object to and from XML
representation.
|
boolean |
equals(Object object)
Default implementation of equality checking.
|
static JDOObject |
fromXML(String xml)
Parse the object out of the XML representation of this object.
|
Object |
getObjectId()
Return the
ObjectId of this persistent instance. |
javax.jdo.PersistenceManager |
getPersistenceManager()
Return the persistence manager associated with this instance.
|
StartLetter |
getStartLetter()
Return the reference to the starting letter of the primary string field
for this instance.
|
int |
hashCode()
Default computation of a hash code for the object.
|
void |
jdoPostLoad()
InstanceCallbacks method implementation.
|
void |
jdoPreClear()
InstanceCallbacks method implementation.
|
void |
jdoPreDelete()
InstanceCallbacks method implementation.
|
void |
jdoPreStore()
InstanceCallbacks method implementation.
|
protected void |
resetHash()
Reset the
hash value. |
String |
toString()
Return a string representation of this object.
|
String |
toXML()
Return an XML representation of the fields of this object.
|
protected static final Logger logger
protected static final int HASH
hash.protected transient int hash
protected StartLetter startLetter
Factory.save(T, javax.jdo.PersistenceManager) and Factory.delete(T, javax.jdo.PersistenceManager) methods.
Note: Instances of StartLetter are shared across
multiple instances and hence need to be maintained separately. In
particular obsolete instances of this class need to be cleaned up when
deleting instances of JDOObject. Obsolete instances are
created when the current entity is the only instance associated with
a particular StartLetter.
Note: A default StartLetter is assigned to instances
of classes that do not need alphabetical index support.
public String toString()
public Object clone() throws CloneNotSupportedException
Cloneable interface. No special actions are
performed. This method simply allows public access to the
Object.clone method.clone in class ObjectCloneNotSupportedException - If the super-class implementation
throws an error.public boolean equals(Object object)
ObjectId.
If this instance is transient, then the super-class
implementation of equals is used.
Note: Sub-classes are encouraged to over-ride this method if special equality checking rules are desired.
public int hashCode()
ObjectId. If the instance if
transient return the value as obtained from the
super-class implementation.public int compareTo(JDOObject object)
Note: The default implementation just compares the
hashCode() values. It is recommended that sub-classes
over-ride this method for appropriate sort order.
compareTo in interface Comparable<JDOObject>object - The object that is to be compared with this object.protected static com.thoughtworks.xstream.XStream createXStream()
toXML()
and fromXML(java.lang.String) methods to initialise the serialiser in a
standard manner.public String toXML()
Note: Currently this method uses the XStream API to convert the object into XML. This may be modified at a later date to convert into a TMS standard XML format.
createXStream(),
fromXML(java.lang.String)public static JDOObject fromXML(String xml)
xml - The XML representation of this object.createXStream(),
toXML()protected void resetHash()
hash value.public Object getObjectId()
ObjectId of this persistent instance.ObjectId of this instance. Returns
null if this instance is transient.JDOHelper.getObjectIdpublic javax.jdo.PersistenceManager getPersistenceManager()
null if this instance is not persistent.JDOHelper.getPersistenceManagerpublic StartLetter getStartLetter()
public void jdoPostLoad()
jdoPostLoad in interface javax.jdo.listener.LoadCallbackpublic void jdoPreStore()
jdoPreStore in interface javax.jdo.listener.StoreCallbackpublic void jdoPreClear()
jdoPreClear in interface javax.jdo.listener.ClearCallbackpublic void jdoPreDelete()
jdoPreDelete in interface javax.jdo.listener.DeleteCallback