javax.jdo.identity.SingleFieldIdentity - JDO class
javax.jdo.identity
Class SingleFieldIdentity
java.lang.Object javax.jdo.identity.SingleFieldIdentity
- Implemented Interfaces:
-
Externalizable
,Serializable
,Comparable
- Subclasses:
- ByteIdentity, CharIdentity, IntIdentity, LongIdentity, ObjectIdentity, ShortIdentity, StringIdentity
This class is the abstract base class for all single field identity classes. A common case of application identity uses exactly one persistent field in the class to represent identity. In this case, the application can use a standard JDO class instead of creating a new user-defined class for the purpose.
- Since:
- JDO 1.0
Constructor only for Externalizable.
- Since:
- JDO 2.0
int compareTo(T arg0)
- Parameters:
-
arg0
-
boolean equals(Object obj)
Check the class and class name and object type. If restored from serialization, class will be null so compare class name.
- Parameters:
-
obj
- the other object
- Returns:
- true if the class or class name is the same
- Since:
- JDO 1.0
Object getKeyAsObject()
Return the key as an Object. The method is synchronized to avoid race conditions in multi-threaded environments.
- Returns:
- the key as an Object.
- Since:
- JDO 2.0
Class getTargetClass()
Return the target class.
- Returns:
- the target class.
- Since:
- JDO 2.0
String getTargetClassName()
Return the target class name.
- Returns:
- the target class name.
- Since:
- JDO 2.0
int hashCode()
Return the cached hash code.
- Returns:
- the cached hash code.
- Since:
- JDO 1.0
void readExternal(ObjectInput arg0)throws IOException, ClassNotFoundException
- Parameters:
-
arg0
-
void readExternal(ObjectInput in)throws IOException, ClassNotFoundException
Read from the input stream. Creates a new instance with the target class name set
- Parameters:
-
in
-
- Since:
- JDO 1.0
void writeExternal(ObjectOutput arg0)
- Parameters:
-
arg0
-
void writeExternal(ObjectOutput out)
Write to the output stream.
- Parameters:
-
out
- the stream
- Since:
- JDO 1.0