Package org.datanucleus.identity
Class DatastoreIdImpl
- java.lang.Object
-
- org.datanucleus.identity.DatastoreIdImpl
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
,DatastoreId
public class DatastoreIdImpl extends java.lang.Object implements java.io.Serializable, DatastoreId, java.lang.Comparable
An 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 "3258[OID]mydomain.MyClass".- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description int
hashCode
java.lang.Object
keyAsObject
private static long
serialVersionUID
protected static java.lang.String
STRING_DELIMITER
java.lang.String
targetClassName
java.lang.String
toString
-
Constructor Summary
Constructors Constructor Description DatastoreIdImpl(java.lang.String str)
Constructs a DatastoreId from its string representation that is consistent with the output of toString().DatastoreIdImpl(java.lang.String pcClass, java.lang.Object key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.lang.Object o)
boolean
equals(java.lang.Object obj)
java.lang.Object
getKeyAsObject()
Provides the identity in a form that can be used by the database as a key.java.lang.String
getTargetClassName()
Accessor for the target class name for the persistable object this represents.int
hashCode()
java.lang.String
toString()
Creates a String representation of the datastore identity, formed from the target class name and the key value.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
STRING_DELIMITER
protected static final transient java.lang.String STRING_DELIMITER
- See Also:
- Constant Field Values
-
keyAsObject
public final java.lang.Object keyAsObject
-
targetClassName
public final java.lang.String targetClassName
-
toString
public final java.lang.String toString
-
hashCode
public final int hashCode
-
-
Constructor Detail
-
DatastoreIdImpl
public DatastoreIdImpl(java.lang.String pcClass, java.lang.Object key)
-
DatastoreIdImpl
public DatastoreIdImpl(java.lang.String str) throws java.lang.IllegalArgumentException
Constructs a DatastoreId from its string representation that is consistent with the output of toString().- Parameters:
str
- the string representation of a DatastoreId- 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: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
-
getTargetClassName
public java.lang.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(java.lang.Object obj)
- Specified by:
equals
in interfaceDatastoreId
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceDatastoreId
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Creates a String representation of the datastore identity, formed from the target class name and the key value. This will be something like3254[OID]mydomain.MyClass
- Specified by:
toString
in interfaceDatastoreId
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The String form of the identity
-
-