org.exolab.castor.persist
Class OID

java.lang.Object
  extended by org.exolab.castor.persist.OID
All Implemented Interfaces:
Serializable

public final class OID
extends Object
implements 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: 8994 $ $Date: 2011-08-02 01:40:59 +0200 (Di, 02 Aug 2011) $
Author:
Assaf Arkin, Ralf Joachim, Wensheng Dou
See Also:
Serialized Form

Constructor Summary
protected OID()
          Protected default constructor invoked through reflection for testing only.
  OID(ClassMolder molder, Identity identity)
          Constructor.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the two OID's are identical.
 OID getDepended()
          Get the depended object's OID.
 Identity getIdentity()
          Return the object's identity, if known.
 int hashCode()
          
 boolean isDbLock()
          Returns true if the object represented by this OID has a database lock.
 void setDepended(OID depended)
          Set the depended object's oid.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OID

protected OID()
Protected default constructor invoked through reflection for testing only.


OID

public OID(ClassMolder molder,
           Identity identity)
Constructor.

Parameters:
molder - ClassMolder of the entity.
identity - Identity of the entity.
Method Detail

getIdentity

public Identity getIdentity()
Return the object's identity, if known. An 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.

setDepended

public void setDepended(OID depended)
Set the depended object's oid.

Parameters:
depended - The depended object's oid.

getDepended

public OID getDepended()
Get the depended object's OID.

Returns:
the depended object's OID.

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.

equals

public boolean equals(Object obj)
Returns true if the two OID's are identical. Two OID's are identical only if they represent the same top level entity 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 class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.