org.apache.torque.om
Class ObjectKey

java.lang.Object
  extended by org.apache.torque.om.ObjectKey
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
ComboKey, SimpleKey

public abstract class ObjectKey
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

This class can be used to uniquely identify an object within an application. There are four subclasses: StringKey, NumberKey, and DateKey, and ComboKey which is a Key made up of a combination ofthe first three.

Version:
$Id: ObjectKey.java 473821 2006-11-11 22:37:25Z tv $
Author:
John McNally
See Also:
Serialized Form

Field Summary
protected  java.lang.Object key
          The underlying key value.
 
Constructor Summary
protected ObjectKey()
          Initializes the internal key value to null.
 
Method Summary
 void appendTo(java.lang.StringBuffer sb)
          Appends a String representation of the key to a buffer.
 int compareTo(java.lang.Object obj)
          Implements the compareTo method.
 java.lang.Object getValue()
          Get the underlying object.
 int hashCode()
          Returns the hashcode of the underlying value (key), if key is not null.
abstract  void setValue(java.lang.String s)
          Reset the underlying object using a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

protected java.lang.Object key
The underlying key value.

Constructor Detail

ObjectKey

protected ObjectKey()
Initializes the internal key value to null.

Method Detail

hashCode

public int hashCode()
Returns the hashcode of the underlying value (key), if key is not null. Otherwise calls Object.hashCode()

Overrides:
hashCode in class java.lang.Object
Returns:
an int value

getValue

public java.lang.Object getValue()
Get the underlying object.

Returns:
the underlying object

appendTo

public void appendTo(java.lang.StringBuffer sb)
Appends a String representation of the key to a buffer.

Parameters:
sb - a StringBuffer

compareTo

public int compareTo(java.lang.Object obj)
Implements the compareTo method.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - the object to compare to this object
Returns:
a numeric comparison of the two values

setValue

public abstract void setValue(java.lang.String s)
                       throws TorqueException
Reset the underlying object using a String.

Parameters:
s - a String value
Throws:
TorqueException - if an error occurs


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.