Package org.datanucleus.identity
Class DatastoreUniqueLongId
- java.lang.Object
-
- org.datanucleus.identity.DatastoreUniqueLongId
-
- All Implemented Interfaces:
Serializable
,Comparable
,DatastoreId
public class DatastoreUniqueLongId extends Object implements Serializable, DatastoreId, Comparable
Identity for use with datastore-identity where the datastore provides a unique "identity" long key per object and hence doesn't need the class name. The behaviour of this class is governed by JDO spec 5.4.3.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description long
key
-
Constructor Summary
Constructors Constructor Description DatastoreUniqueLongId()
DatastoreUniqueLongId(long key)
DatastoreUniqueLongId(String str)
Constructs an OID from its string representation that is consistent with the output of toString().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
boolean
equals(Object obj)
long
getKey()
Object
getKeyAsObject()
Provides the identity in a form that can be used by the database as a key.String
getTargetClassName()
Accessor for the target class name for the persistable object this represents.int
hashCode()
String
toString()
Creates a String representation of the datastore identity, formed from the key value.
-
-
-
Constructor Detail
-
DatastoreUniqueLongId
public DatastoreUniqueLongId()
-
DatastoreUniqueLongId
public DatastoreUniqueLongId(long key)
-
DatastoreUniqueLongId
public DatastoreUniqueLongId(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
-
getKeyAsObject
public Object getKeyAsObject()
Description copied from interface:DatastoreId
Provides the identity in a form that can be used by the database as a key.- Specified by:
getKeyAsObject
in interfaceDatastoreId
- Returns:
- The key value
-
getKey
public long getKey()
-
getTargetClassName
public String getTargetClassName()
Description copied from interface:DatastoreId
Accessor for the target class name for the persistable object this represents.- Specified by:
getTargetClassName
in interfaceDatastoreId
- Returns:
- the class name of the persistable
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceDatastoreId
- Overrides:
equals
in classObject
-
compareTo
public int compareTo(Object o)
- Specified by:
compareTo
in interfaceComparable
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceDatastoreId
- Overrides:
hashCode
in classObject
-
toString
public String toString()
Creates a String representation of the datastore identity, formed from the key value. This will be something like3254
- Specified by:
toString
in interfaceDatastoreId
- Overrides:
toString
in classObject
- Returns:
- The String form of the identity
-
-