org.exolab.core.foundation
Class PersistentObject

java.lang.Object
  extended by org.exolab.core.foundation.PersistentObject
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, PersistentCapableIfc
Direct Known Subclasses:
PMDHandle, PMDHashMap, PMDTreeMap, PMDTreeSet, PMDVector

public abstract class PersistentObject
extends java.lang.Object
implements PersistentCapableIfc, java.lang.Cloneable, java.io.Externalizable

This is the base class for all persistent objects. A persistent object is on that can be placed in a persistent store, is transactional, is lockable etc. All persistent objects, must derive from this class; with no exception. This class also has an id and version, which uniquely identifies this object within an application.

This object is also Serializable

Version:
$Revision: 1.7 $ $Date: 2003/06/09 06:28:39 $
Author:
Jim Alateras
See Also:
ObjectId, VersionId, PersistentCapableIfc, Serializable, Serialized Form

Constructor Summary
PersistentObject()
          The default constructor does nothing
PersistentObject(ObjectId id, ObjectVersion version)
          Instantiate an instance of this class with the specified object id and version number.
 
Method Summary
 java.lang.Object clone()
          Clone this object and its base objects.
 boolean equals(java.lang.Object object)
          Check if the two objects are equal.
 long getId()
          Return an instance of the object identity
 int getMinimumObjectSize()
          Return the minimum size of this object.
 ObjectId getObjectId()
          Return the object identifier associated with this object
 ObjectVersion getObjectVersion()
          Return the object version associated with this object
 long getVersion()
          Return the version of the object
 void readExternal(java.io.ObjectInput stream)
           
 void setId(long id)
          Set the object id using the passed in identifier.
 void setMinimumObjectSize(int size)
          Set the minimum size that the object should occurpy.
 void setObjectId(ObjectId id)
          Set the object id for this persistent object using the specified object.
 void setObjectVersion(ObjectVersion version)
          Set the object version for this persistent object using the specified object.
 void setVersion(long version)
          Set the object version using the passed in identifier.
 void writeExternal(java.io.ObjectOutput stream)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentObject

public PersistentObject()
The default constructor does nothing


PersistentObject

public PersistentObject(ObjectId id,
                        ObjectVersion version)
Instantiate an instance of this class with the specified object id and version number.

Parameters:
id - unique object identifier
version - version number
Method Detail

setId

public void setId(long id)
Set the object id using the passed in identifier.

Parameters:
id - unique object id

getId

public long getId()
Return an instance of the object identity

Returns:
long

setObjectId

public void setObjectId(ObjectId id)
Set the object id for this persistent object using the specified object.

Parameters:
id - object id

getObjectId

public ObjectId getObjectId()
Return the object identifier associated with this object

Specified by:
getObjectId in interface PersistentCapableIfc
Returns:
ObjectId

setVersion

public void setVersion(long version)
Set the object version using the passed in identifier.

Parameters:
version - version

getVersion

public long getVersion()
Return the version of the object

Returns:
long

setObjectVersion

public void setObjectVersion(ObjectVersion version)
Set the object version for this persistent object using the specified object.

Parameters:
version - object version

getObjectVersion

public ObjectVersion getObjectVersion()
Return the object version associated with this object

Specified by:
getObjectVersion in interface PersistentCapableIfc
Returns:
ObjectId

setMinimumObjectSize

public void setMinimumObjectSize(int size)
Set the minimum size that the object should occurpy. It is only a hint.

Specified by:
setMinimumObjectSize in interface PersistentCapableIfc
Parameters:
size - minimum object size

getMinimumObjectSize

public int getMinimumObjectSize()
Return the minimum size of this object. This vould be used to preallocate the object size for more efficient storage.

Specified by:
getMinimumObjectSize in interface PersistentCapableIfc
Returns:
int

equals

public boolean equals(java.lang.Object object)
Check if the two objects are equal. Equality implies that both objects are the same type and the object id's of the objects are equal

Overrides:
equals in class java.lang.Object
Parameters:
object - object to compare against
Returns:
boolean true if identical

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone this object and its base objects.

Overrides:
clone in class java.lang.Object
Returns:
Obect - the cloned object
Throws:
java.lang.CloneNotSupportedException

writeExternal

public void writeExternal(java.io.ObjectOutput stream)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput stream)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException


Copyright © 1999-2012 The Exolab Group. All Rights Reserved.