Package org.datanucleus.identity
Class DatastoreIdImplKodo
- java.lang.Object
-
- org.datanucleus.identity.DatastoreIdImplKodo
-
- All Implemented Interfaces:
Serializable,Comparable,DatastoreId
public class DatastoreIdImplKodo extends Object implements Serializable, DatastoreId, 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 OpenJPA/Kodo.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description inthashCodeObjectkeyAsObjectprotected static StringSTRING_DELIMITERStringtargetClassNameStringtoString
-
Constructor Summary
Constructors Constructor Description DatastoreIdImplKodo(String str)Constructs a DatastoreId from its string representation that is consistent with the output of toString().DatastoreIdImplKodo(String pcClass, Object key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o)booleanequals(Object obj)ObjectgetKeyAsObject()Provides the identity in a form that can be used by the database as a key.StringgetTargetClassName()Accessor for the target class name for the persistable object this represents.inthashCode()StringtoString()Creates a String representation of the datastore identity, formed from the target class name and the key value.
-
-
-
Field Detail
-
STRING_DELIMITER
protected static final transient String STRING_DELIMITER
- See Also:
- Constant Field Values
-
keyAsObject
public final Object keyAsObject
-
targetClassName
public final String targetClassName
-
toString
public final String toString
-
hashCode
public final int hashCode
-
-
Constructor Detail
-
DatastoreIdImplKodo
public DatastoreIdImplKodo(String str) throws IllegalArgumentException
Constructs a DatastoreId from its string representation that is consistent with the output of toString().- Parameters:
str- the string representation of the DatastoreId- Throws:
IllegalArgumentException- if the given string representation is not valid.- See Also:
toString
-
-
Method Detail
-
getKeyAsObject
public 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
-
getTargetClassName
public 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(Object obj)
- Specified by:
equalsin interfaceDatastoreId- Overrides:
equalsin classObject
-
compareTo
public int compareTo(Object o)
- Specified by:
compareToin interfaceComparable
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceDatastoreId- Overrides:
hashCodein classObject
-
toString
public String toString()
Creates a String representation of the datastore identity, formed from the target class name and the key value. This will be something likemydomain.MyClass-3254
- Specified by:
toStringin interfaceDatastoreId- Overrides:
toStringin classObject- Returns:
- The String form of the identity
-
-