org.datanucleus.identity
Class OIDImplXcalia

java.lang.Object
  extended by org.datanucleus.identity.OIDImplXcalia
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, OID

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

Object identifier, typically used for datastore identity. The behaviour of this class is governed by JDO spec 5.4.3. Utilises a String form of the style "mydomain.MyClass:3258". This is a form similar to Xcalia. Note : Xcalia also allows "{alias}:3258" but this isn't catered for here yet

See Also:
Serialized Form

Field Summary
 int hashCode
          pre-created hasCode to improve performance
protected static Localiser LOCALISER
          Localiser for messages.
 java.lang.Object oid
          The key value.
 java.lang.String pcClass
          The PersistenceCapable class name
 java.lang.String toString
          pre-created toString to improve performance
 
Constructor Summary
OIDImplXcalia()
          Creates an OID with no value.
OIDImplXcalia(java.lang.String str)
          Constructs an OID from its string representation that is consistent with the output of toString().
OIDImplXcalia(java.lang.String pcClass, java.lang.Object object)
          Create a string datastore identity.
 
Method Summary
 int compareTo(java.lang.Object o)
          Comparator method.
 boolean equals(java.lang.Object obj)
          Equality operator.
 java.lang.Object getKeyValue()
          Accessor for the key value.
 java.lang.String getPcClass()
          Accessor for the PersistenceCapable class name.
 int hashCode()
          Accessor for the hashcode
 java.lang.String toString()
          Creates a String representation of the datastore identity, formed from the PC class name and the key value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER

protected static final transient Localiser LOCALISER
Localiser for messages.


oid

public final java.lang.Object oid
The key value.


pcClass

public final java.lang.String pcClass
The PersistenceCapable class name


toString

public final java.lang.String toString
pre-created toString to improve performance


hashCode

public final int hashCode
pre-created hasCode to improve performance

Constructor Detail

OIDImplXcalia

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


OIDImplXcalia

public OIDImplXcalia(java.lang.String pcClass,
                     java.lang.Object object)
Create a string datastore identity.

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

OIDImplXcalia

public OIDImplXcalia(java.lang.String str)
              throws java.lang.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:
java.lang.IllegalArgumentException - if the given string representation is not valid.
See Also:
toString
Method Detail

getKeyValue

public java.lang.Object getKeyValue()
Accessor for the key value.

Specified by:
getKeyValue in interface OID
Returns:
The key value

getPcClass

public java.lang.String getPcClass()
Accessor for the PersistenceCapable class name.

Specified by:
getPcClass in interface OID
Returns:
PC class name

equals

public boolean equals(java.lang.Object obj)
Equality operator.

Specified by:
equals in interface OID
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to compare against
Returns:
Whether they are equal

compareTo

public int compareTo(java.lang.Object o)
Comparator method.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The object to compare against
Returns:
The comparison result

hashCode

public int hashCode()
Accessor for the hashcode

Specified by:
hashCode in interface OID
Overrides:
hashCode in class java.lang.Object
Returns:
Hashcode for this object

toString

public java.lang.String toString()
Creates a String representation of the datastore identity, formed from the PC class name and the key value. This will be something like
mydomain.MyClass:3254

Specified by:
toString in interface OID
Overrides:
toString in class java.lang.Object
Returns:
The String form of the identity


Copyright © 2010. All Rights Reserved.