- java.lang.Object
 - 
- org.datanucleus.identity.SingleFieldId
 - 
- org.datanucleus.identity.ObjectId
 
 
 
- 
- All Implemented Interfaces:
 Externalizable,Serializable,Comparable
public class ObjectId extends SingleFieldId
This class is for identity with a single Object type field.- See Also:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceObjectId.StringConstructorConstruct an instance of a key class using a String as input. 
- 
Field Summary
- 
Fields inherited from class org.datanucleus.identity.SingleFieldId
hashCode, STRING_DELIMITER, targetClassName 
 - 
 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o)static ObjectconstructKey(String className, String keyString)Construct an instance of the parameter class, using the keyString as an argument to the constructor.ObjectgetKey()ObjectgetKeyAsObject()protected booleankeyEquals(SingleFieldId obj)voidreadExternal(ObjectInput in)Read this object.static ObjectregisterStringConstructor(Class cls, ObjectId.StringConstructor sc)Register special StringConstructor instances.StringtoString()Return the String form of the object id.voidwriteExternal(ObjectOutput out)Write this object.- 
Methods inherited from class org.datanucleus.identity.SingleFieldId
assertKeyNotNull, compare, equals, getTargetClassName, hashCode 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getKey
public Object getKey()
 
- 
getKeyAsObject
public Object getKeyAsObject()
- Specified by:
 getKeyAsObjectin classSingleFieldId
 
- 
toString
public String toString()
Return the String form of the object id. The class of the object id is written as the first part of the result so that the class can be reconstructed later. Then the toString of the key instance is appended. During construction, this process is reversed. The class is extracted from the first part of the String, and the String constructor of the key is used to construct the key itself. 
- 
keyEquals
protected boolean keyEquals(SingleFieldId obj)
- Specified by:
 keyEqualsin classSingleFieldId
 
- 
compareTo
public int compareTo(Object o)
 
- 
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
Write this object. Write the superclass first.- Specified by:
 writeExternalin interfaceExternalizable- Overrides:
 writeExternalin classSingleFieldId- Parameters:
 out- the output- Throws:
 IOException
 
- 
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
Read this object. Read the superclass first.- Specified by:
 readExternalin interfaceExternalizable- Overrides:
 readExternalin classSingleFieldId- Parameters:
 in- the input- Throws:
 IOExceptionClassNotFoundException
 
- 
registerStringConstructor
public static Object registerStringConstructor(Class cls, ObjectId.StringConstructor sc)
Register special StringConstructor instances. These instances are for constructing instances from String parameters where there is no String constructor for them.- Parameters:
 cls- the class to register a StringConstructor forsc- the StringConstructor instance- Returns:
 - the previous StringConstructor registered for this class
 
 
- 
constructKey
public static Object constructKey(String className, String keyString)
Construct an instance of the parameter class, using the keyString as an argument to the constructor. If the class has a StringConstructor instance registered, use it. If not, try to find a constructor for the class with a single String argument. Otherwise, throw a NucleusUserException.- Parameters:
 className- the name of the classkeyString- the String parameter for the constructor- Returns:
 - the result of construction
 
 
 - 
 
 -