Package org.exolab.castor.persist
Class OID
- java.lang.Object
-
- org.exolab.castor.persist.OID
-
- All Implemented Interfaces:
java.io.Serializable
public final class OID extends java.lang.Object implements java.io.Serializable
Object identifier. An object identifier is unique within a cache engine or other persistence mechanism and is used to locate object based on their identity as well as assure no duplicate identities. The object type and it's identity object define the OID's identity. In addition the OID is used to hold the object's stamp and db-lock access fields which are used to optimize dirty checking within a transaction.- Version:
- $Revision: 8104 $ $Date: 2006-04-22 11:05:30 -0600 (Sat, 22 Apr 2006) $
- Author:
- Assaf Arkin
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OID(ClassMolder molder, OID depends, Identity identity)
Constructor.OID(ClassMolder molder, Identity identity)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Returns true if the two OID's are identical.OID
getDepends()
Get the depended object's oid.Identity
getIdentity()
Return the object's identity, if known.ClassMolder
getMolder()
Get the ClassMolder of this object.(package private) java.lang.String
getName()
Return the full qualified name of the object's type.(package private) java.lang.String[]
getSuperClassNames()
Return the full qualified names of the object's superclasses, if any, otherwise returns null.(package private) java.lang.String
getTopClassName()
int
hashCode()
boolean
isDbLock()
Returns true if the object represented by this OID has a database lock.(package private) void
setDbLock(boolean dbLock)
Specifies whether the object represented by this OID has a database lock.java.lang.String
toString()
-
-
-
Constructor Detail
-
OID
public OID(ClassMolder molder, Identity identity)
Constructor.
-
OID
public OID(ClassMolder molder, OID depends, Identity identity)
Constructor.
-
-
Method Detail
-
getDepends
public OID getDepends()
Get the depended object's oid.- Returns:
- the depended object's oid.
-
getMolder
public ClassMolder getMolder()
Get the ClassMolder of this object.- Returns:
- the ClassMolder of this object.
-
setDbLock
void setDbLock(boolean dbLock)
Specifies whether the object represented by this OID has a database lock. Database locks overrides the need to perform dirty checking on the object. This status is set when the object is loaded with db-lock access, created or deleted. It is reset when the object is unlocked.- Parameters:
dbLock
- True the object represented by this OID has a database lock
-
isDbLock
public boolean isDbLock()
Returns true if the object represented by this OID has a database lock. Database locks overrides the need to perform dirty checking on the object. This status is set when the object is loaded with db-lock access, created or deleted. It is reset when the object is unlocked.- Returns:
- True the object represented by this OID is loaded with a datbase lock
-
getIdentity
public Identity getIdentity()
Return the object's identity, if known. And identity exists for every object that was loaded within a transaction and for those objects that were created with an identity. No two objects may have the same identity in persistent storage. If the object was created without an identity this method will return null until the object is first stored and it's identity is set.- Returns:
- The object's identity, or null
-
getName
java.lang.String getName()
Return the full qualified name of the object's type. When using inheritance this is the type's full name of the top most object in the inheritance heirarchy specified in the object mapping.- Returns:
- The object's type's full name
-
getTopClassName
java.lang.String getTopClassName()
-
getSuperClassNames
java.lang.String[] getSuperClassNames()
Return the full qualified names of the object's superclasses, if any, otherwise returns null.- Returns:
- The object's type's superclasses full name
-
equals
public boolean equals(java.lang.Object obj)
Returns true if the two OID's are identical. Two OID's are identical only if they represent the same object type and have the same identity (based on equality test). If no identity was specified for either or both objects, the objects are not identical.- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-