org.apache.jdo.impl.fostore
Class OID

java.lang.Object
  extended by org.apache.jdo.impl.fostore.OID
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
AID

public class OID
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

Represents the identity of a JDO object in the File/Object store. This implementation uses datastore identity. The identity is based on the class of the object and a unique identifier within that class. These OID's are unique only within a single datastore.

This class is public as required by the JDO specification.

Version:
1.0.1
Author:
Dave Bristor
See Also:
Serialized Form

Field Summary
 long oid
          The 'value' of this OID.
 
Constructor Summary
OID()
          Creates an OID with the no value.
OID(long oid)
          Creates an OID with the given value.
OID(java.lang.String str)
          Constructor that takes the result of toString() and creates a new OID.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compare this OID to another OID.
 boolean equals(java.lang.Object other)
          Determines if this OID is equal to another.
 org.apache.jdo.impl.fostore.CLID getCLID()
          Provides the CLID part of this OID.
 long getUID()
          Provides the unique id part of this OID.
 int hashCode()
          Provides a JVM-unique hashCode for this OID.
 boolean isProvisional()
          Indicates whether this OID is provisional.
 java.lang.String oidString()
          Returns the id itself in String form, for debugging.
 java.lang.String toString()
          Returns a String representation of this OID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

public long oid
The 'value' of this OID.

Constructor Detail

OID

public OID()
Creates an OID with the no value.


OID

public OID(java.lang.String str)
Constructor that takes the result of toString() and creates a new OID. Currently only the CLID and UID are used. The provisional bits are ignored.

See Also:
toString()

OID

public OID(long oid)
Creates an OID with the given value.

Method Detail

isProvisional

public boolean isProvisional()
Indicates whether this OID is provisional.

Returns:
true if this OID is provisional, false otherwise.

getCLID

public org.apache.jdo.impl.fostore.CLID getCLID()
Provides the CLID part of this OID. The resulting CLID is provisional if it is provisional within this OID. I.e., this might be a provisional OID, but the CLID part could still be datastore-assigned.

Returns:
The CLID part of this OID.

getUID

public long getUID()
Provides the unique id part of this OID.

Returns:
The unique id part of this OID.

hashCode

public int hashCode()
Provides a JVM-unique hashCode for this OID.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Determines if this OID is equal to another.

Overrides:
equals in class java.lang.Object
Parameters:
other - The other OID in the equality comparison.
Returns:
True if they are equal, false otherwise.

toString

public java.lang.String toString()
Returns a String representation of this OID. Includes whether or not the OID is provisional, and its reserved bits, if they are set.

Overrides:
toString in class java.lang.Object

oidString

public java.lang.String oidString()
Returns the id itself in String form, for debugging.


compareTo

public int compareTo(java.lang.Object obj)
Compare this OID to another OID. This is needed to implement an absolute ordering of OIDs. The ordering must provide for comparing provisional OIDs to permanent OIDs, with all provisional OIDs comparing greater than all permanent OIDs.

Specified by:
compareTo in interface java.lang.Comparable
Since:
1.0.1


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.