Package org.datanucleus.identity
Class DatastoreUniqueLongId
- java.lang.Object
-
- org.datanucleus.identity.DatastoreUniqueLongId
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable,DatastoreId
public class DatastoreUniqueLongId extends java.lang.Object implements java.io.Serializable, DatastoreId, java.lang.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 longkeyprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description DatastoreUniqueLongId()DatastoreUniqueLongId(long key)DatastoreUniqueLongId(java.lang.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 intcompareTo(java.lang.Object o)booleanequals(java.lang.Object obj)longgetKey()java.lang.ObjectgetKeyAsObject()Provides the identity in a form that can be used by the database as a key.java.lang.StringgetTargetClassName()Accessor for the target class name for the persistable object this represents.inthashCode()java.lang.StringtoString()Creates a String representation of the datastore identity, formed from the key value.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
key
public final long key
-
-
Constructor Detail
-
DatastoreUniqueLongId
public DatastoreUniqueLongId()
-
DatastoreUniqueLongId
public DatastoreUniqueLongId(long key)
-
DatastoreUniqueLongId
public DatastoreUniqueLongId(java.lang.String str) throws java.lang.IllegalArgumentExceptionConstructs 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
-
getKeyAsObject
public java.lang.Object getKeyAsObject()
Description copied from interface:DatastoreIdProvides the identity in a form that can be used by the database as a key.- Specified by:
getKeyAsObjectin interfaceDatastoreId- Returns:
- The key value
-
getKey
public long getKey()
-
getTargetClassName
public java.lang.String getTargetClassName()
Description copied from interface:DatastoreIdAccessor for the target class name for the persistable object this represents.- Specified by:
getTargetClassNamein interfaceDatastoreId- Returns:
- the class name of the persistable
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfaceDatastoreId- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareToin interfacejava.lang.Comparable
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceDatastoreId- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Creates a String representation of the datastore identity, formed from the key value. This will be something like3254
- Specified by:
toStringin interfaceDatastoreId- Overrides:
toStringin classjava.lang.Object- Returns:
- The String form of the identity
-
-