org.apache.turbine.om
Class NumberKey

java.lang.Object
  |
  +--org.apache.turbine.om.ObjectKey
        |
        +--org.apache.turbine.om.SimpleKey
              |
              +--org.apache.turbine.om.NumberKey
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class NumberKey
extends SimpleKey

This class can be used as an ObjectKey to uniquely identify an object within an application where the id consists of a single entity such a GUID or the value of a db row's primary key.

See Also:
Serialized Form

Fields inherited from class org.apache.turbine.om.ObjectKey
key
 
Constructor Summary
NumberKey()
          Creates a NumberKey whose internal representation will be set later, through a set method
NumberKey(java.math.BigDecimal key)
          Creates a NumberKey equivalent to key.
NumberKey(int key)
          Creates a NumberKey equivalent to key.
NumberKey(long key)
          Creates a NumberKey equivalent to key.
NumberKey(NumberKey key)
          Creates a NumberKey equivalent to key.
NumberKey(java.lang.String key)
          Creates a NumberKey equivalent to key.
 
Method Summary
 boolean equals(java.lang.Object keyObj)
          keyObj is equal to this NumberKey if keyObj is a NumberKey or String that contains the same information this key contains.
 java.math.BigDecimal getBigDecimal()
          Access the underlying BigDecimal object.
 void setValue(java.math.BigDecimal key)
          Sets the underlying object
 void setValue(NumberKey key)
          Sets the internal representation to the same object used by key.
 void setValue(java.lang.String key)
          Sets the internal representation using a String representation of a number
 java.lang.String toString()
          Invokes the toString() method on the object.
 
Methods inherited from class org.apache.turbine.om.ObjectKey
appendTo, compareTo, getValue, hashCode
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

NumberKey

public NumberKey()
Creates a NumberKey whose internal representation will be set later, through a set method

NumberKey

public NumberKey(java.lang.String key)
Creates a NumberKey equivalent to key.

NumberKey

public NumberKey(java.math.BigDecimal key)
Creates a NumberKey equivalent to key.

NumberKey

public NumberKey(NumberKey key)
Creates a NumberKey equivalent to key.

NumberKey

public NumberKey(long key)
Creates a NumberKey equivalent to key.

NumberKey

public NumberKey(int key)
Creates a NumberKey equivalent to key. Convenience only. Not very efficient at all.
Method Detail

setValue

public void setValue(java.lang.String key)
              throws java.lang.NumberFormatException
Sets the internal representation using a String representation of a number
Overrides:
setValue in class ObjectKey
Following copied from class: org.apache.turbine.om.ObjectKey
Parameters:
s - a String value
Throws:
TurbineException - if an error occurs

setValue

public void setValue(java.math.BigDecimal key)
Sets the underlying object

setValue

public void setValue(NumberKey key)
Sets the internal representation to the same object used by key.

getBigDecimal

public java.math.BigDecimal getBigDecimal()
Access the underlying BigDecimal object.
Returns:
a BigDecimal value

equals

public boolean equals(java.lang.Object keyObj)
keyObj is equal to this NumberKey if keyObj is a NumberKey or String that contains the same information this key contains.
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Invokes the toString() method on the object.
Overrides:
toString in class java.lang.Object


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.