org.jpox.store
Class OID

java.lang.Object
  extended by org.jpox.store.OID
All Implemented Interfaces:
Serializable

public class OID
extends Object
implements Serializable

An object identifier. OIDs are normally used as object identifiers for persistent objects that use datastore identity. They're also used for view objects, which actually use non-datastore identity. The behaviour of this class is governed by JDO spec 5.4.3.

Version:
$Revision: 1.17 $
See Also:
Serialized Form

Field Summary
 int hashCode
          pre-created hasCode to improve performance *
 Object oid
          The identity.
 String pcClass
          The PersistenceCapable class name
 String toString
          pre-created toString to improve performance *
 
Constructor Summary
OID()
          Creates an OID with the no value.
OID(String str)
          Constructs an OID from its string representation that is consistent with the output of toString().
OID(String pcClass, Object object)
          Create a string datastore identity
 
Method Summary
 boolean equals(Object obj)
          Equality operator.
 Object getNewObjectIdCopy()
          Returns copy of the requested oid to be accessed by the user.
 String getPcClass()
          Accessor for the PC class name
 int hashCode()
          Accessor for the hashcode
 Object keyValue()
          Provides the OID in a form that can be used by the database as a key.
 String toString()
          Returns the string representation of the OID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

public final Object oid
The identity.


pcClass

public final String pcClass
The PersistenceCapable class name


toString

public final String toString
pre-created toString to improve performance *


hashCode

public final int hashCode
pre-created hasCode to improve performance *

Constructor Detail

OID

public OID()
Creates an OID with the no value. Required by the JDO spec


OID

public OID(String pcClass,
           Object object)
Create a string datastore identity

Parameters:
pcClass - The PersistenceCapable class that this represents
object - The value

OID

public OID(String str)
    throws IllegalArgumentException
Constructs an OID from its string representation that is consistent with the output of toString().

Parameters:
str - the string representation of an OID.
Throws:
IllegalArgumentException - if the given string representation is not valid.
See Also:
toString
Method Detail

getNewObjectIdCopy

public Object getNewObjectIdCopy()
Returns copy of the requested oid to be accessed by the user.

Returns:
Copy of the OID.

keyValue

public Object keyValue()
Provides the OID in a form that can be used by the database as a key.

Returns:
The key value

equals

public boolean equals(Object obj)
Equality operator.

Overrides:
equals in class Object
Parameters:
obj - Object to compare against
Returns:
Whether they are equal

hashCode

public int hashCode()
Accessor for the hashcode

Overrides:
hashCode in class Object
Returns:
Hashcode for this object

toString

public String toString()
Returns the string representation of the OID. Will be a string such as "1[OID]org.jpox.samples.MyClass" where

Overrides:
toString in class Object
Returns:
the string representation of the OID.

getPcClass

public String getPcClass()
Accessor for the PC class name

Returns:
the PC Class


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.