|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.torque.om.ObjectKey
org.apache.torque.om.SimpleKey
org.apache.torque.om.NumberKey
public class NumberKey
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.
| Field Summary |
|---|
| Fields inherited from class org.apache.torque.om.ObjectKey |
|---|
key |
| Constructor Summary | |
|---|---|
NumberKey()
Creates a NumberKey whose internal representation will be set later, through a set method |
|
NumberKey(BigDecimal key)
Creates a NumberKey equivalent to key. |
|
NumberKey(double 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(Number key)
Creates a NumberKey equivalent to key. |
|
NumberKey(NumberKey key)
Creates a NumberKey equivalent to key. |
|
NumberKey(String key)
Creates a NumberKey equivalent to key. |
|
| Method Summary | |
|---|---|
byte |
byteValue()
Returns the value of this NumberKey as a byte. |
int |
compareTo(Object o)
Implements the compareTo method. |
double |
doubleValue()
Returns the value of this NumberKey as a double. |
float |
floatValue()
Returns the value of this NumberKey as a float. |
BigDecimal |
getBigDecimal()
Access the underlying BigDecimal object. |
int |
getJdbcType()
Returns the JDBC type of the key as defined in java.sql.Types. |
int |
hashCode()
Returns the hashcode of the underlying value (key), if key is not null. |
int |
intValue()
Returns the value of this NumberKey as an int. |
long |
longValue()
Returns the value of this NumberKey as a long. |
void |
setValue(BigDecimal key)
Sets the underlying object. |
void |
setValue(NumberKey key)
Sets the internal representation to the same object used by key. |
void |
setValue(String key)
Sets the internal representation using a String representation of a number. |
short |
shortValue()
Returns the value of this NumberKey as a short. |
String |
toString()
Get a String representation of this key. |
| Methods inherited from class org.apache.torque.om.SimpleKey |
|---|
keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor |
| Methods inherited from class org.apache.torque.om.ObjectKey |
|---|
appendTo, equals, getValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NumberKey()
public NumberKey(String key)
key.
key - the key valuepublic NumberKey(BigDecimal key)
key.
key - the key valuepublic NumberKey(NumberKey key)
key.
key - the key valuepublic NumberKey(long key)
key.
key - the key valuepublic NumberKey(double key)
key.
key - the key valuepublic NumberKey(int key)
key.
Convenience only.
key - the key valuepublic NumberKey(Number key)
key.
Convenience only.
key - the key value| Method Detail |
|---|
public void setValue(String key)
setValue in class ObjectKeykey - the key value
NumberFormatException - if key is not a valid numberpublic void setValue(BigDecimal key)
key - the key value.public void setValue(NumberKey key)
key - the key valuepublic int getJdbcType()
java.sql.Types.
getJdbcType in class ObjectKeyTypes.NUMERIC.public BigDecimal getBigDecimal()
BigDecimal valuepublic int hashCode()
ObjectKey
hashCode in class ObjectKeypublic int compareTo(Object o)
ObjectKey
compareTo in interface Comparable<Object>compareTo in class ObjectKeyo - the comparison value
public String toString()
toString in class Objectpublic byte byteValue()
Number.byteValue()
public int intValue()
BigDecimal.intValue(), importantly any fractional part
will be discarded and if the underlying value is too big to fit in an
int, only the low-order 32 bits are returned. Note that this
conversion can lose information about the overall magnitude and
precision of the NumberKey value as well as return a result with the
opposite sign.
public short shortValue()
BigDecimal.intValue(), importantly any fractional part
will be discarded and if the underlying value is too big to fit
in a long, only the low-order 64 bits are returned. Note that this
conversion can lose information about the overall magnitude and
precision of the NumberKey value as well as return a result with the
opposite sign.
public long longValue()
BigDecimal.intValue()
public float floatValue()
BigDecimal.floatValue(), most importantly if the
underlying value has too great a magnitude to represent as a
float, it will be converted to Float.NEGATIVE_INFINITY
or Float.POSITIVE_INFINITY as appropriate.
public double doubleValue()
BigDecimal.doubleValue(), most importantly if the
underlying value has too great a magnitude to represent as a
double, it will be converted to Double.NEGATIVE_INFINITY
or Double.POSITIVE_INFINITY as appropriate.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||