Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.torque.om
Class ObjectKey

    java.lang.Object
      org.apache.torque.om.ObjectKey

All Implemented Interfaces:
  Serializable, Comparable<Object>

Direct Known Subclasses:
  ComboKey, SimpleKey

    public abstract class ObjectKey

extends Object
implements Serializable, Comparable<Object>

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 1206841 2011-11-27 20:46:17Z tfischer $
Author:
  John McNally
See Also:
  Serialized Form

Field Summary
`protected Object` | `key` The underlying key value.

Constructor Summary
`protected` | `ObjectKey()` Initializes the internal key value to `null`.

Method Summary
`void` | `appendTo(StringBuffer sb)` Appends a String representation of the key to a buffer.
`int` | `compareTo(Object obj)` Implements the compareTo method.
`boolean` | `equals(Object obj)` Returns whether this ObjekctKey is equal to another Object.
`abstract int` | `getJdbcType()` Returns the JDBC type of the key as defined in `java.sql.Types`.
`Object` | `getValue()` Get the underlying object.
`int` | `hashCode()` Returns the hashcode of the underlying value (key), if key is not null.
`abstract void` | `setValue(String s)` Reset the underlying object using a String.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### key

    protected 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 `Object`
  Returns:
    an `int` value

### equals

    public boolean equals(Object obj)

  Returns whether this ObjekctKey is equal to another Object. obj is equal to this ObjectKey if obj has the same class as this ObjectKey and contains the same information this key contains. Two ObjectKeys that both contain null values are not considered equal.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `obj` - the comparison value.
  Returns:
    whether the two objects are equal.

### getValue

    public Object getValue()

  Get the underlying object.

  Returns:
    the underlying object

### getJdbcType

    public abstract int getJdbcType()

  Returns the JDBC type of the key as defined in `java.sql.Types`.

  Returns:
    the JDBC type of the key.

### appendTo

    public void appendTo(StringBuffer sb)

  Appends a String representation of the key to a buffer.

  Parameters:
    `sb` - a `StringBuffer`

### compareTo

    public int compareTo(Object obj)

  Implements the compareTo method.

  Specified by:
    `compareTo` in interface `Comparable<Object>`
  Parameters:
    `obj` - the object to compare to this object
  Returns:
    a numeric comparison of the two values

### setValue

    public abstract void setValue(String s)
                           throws TorqueException

  Reset the underlying object using a String.

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.