Package org.apache.torque.om
Klasse NumberKey
- Alle implementierten Schnittstellen:
Serializable,Comparable<Object>
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.
- Version:
- $Id: NumberKey.java 1849379 2018-12-20 12:33:43Z tv $
- Autor:
- John McNally, Stephen Haberman, Runako Godfrey
- Siehe auch:
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungInitializes the internal key value tonull.NumberKey(double key) Creates a NumberKey equivalent tokey.NumberKey(int key) Creates a NumberKey equivalent tokey.NumberKey(long key) Creates a NumberKey equivalent tokey.Creates a NumberKey equivalent tokey.Creates an NumberKey and set its internal representationNumberKey(BigDecimal key) Creates an NumberKey and set its internal representationCreates a NumberKey that is equivalent to key. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbyteReturns the value of this NumberKey as a byte.intImplements the compareTo method.doubleReturns the value of this NumberKey as a double.floatReturns the value of this NumberKey as a float.intReturns the JDBC type of the key as defined injava.sql.Types.intintValue()Returns the value of this NumberKey as an int.longReturns the value of this NumberKey as a long.voidSets the internal representation using a String representation of a number.shortReturns the value of this NumberKey as a short.Von Klasse geerbte Methoden org.apache.torque.om.SimpleKey
keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor
-
Konstruktordetails
-
NumberKey
public NumberKey()Initializes the internal key value tonull. -
NumberKey
Creates an NumberKey and set its internal representation- Parameter:
key- the key value as String
-
NumberKey
Creates an NumberKey and set its internal representation- Parameter:
key- the key value
-
NumberKey
Creates a NumberKey that is equivalent to key.- Parameter:
key- the key value
-
NumberKey
public NumberKey(long key) Creates a NumberKey equivalent tokey.- Parameter:
key- the key value
-
NumberKey
public NumberKey(double key) Creates a NumberKey equivalent tokey.- Parameter:
key- the key value
-
NumberKey
public NumberKey(int key) Creates a NumberKey equivalent tokey. Convenience only.- Parameter:
key- the key value
-
NumberKey
Creates a NumberKey equivalent tokey. Convenience only.- Parameter:
key- the key value
-
-
Methodendetails
-
setValue
Sets the internal representation using a String representation of a number.- Parameter:
key- the key value- Löst aus:
NumberFormatException- if key is not a valid number
-
getJdbcType
public int getJdbcType()Returns the JDBC type of the key as defined injava.sql.Types.- Angegeben von:
getJdbcTypein KlasseObjectKey<BigDecimal>- Gibt zurück:
Types.NUMERIC.
-
compareTo
Beschreibung aus Klasse kopiert:ObjectKeyImplements the compareTo method.- Angegeben von:
compareToin SchnittstelleComparable<Object>- Setzt außer Kraft:
compareToin KlasseObjectKey<BigDecimal>- Parameter:
o- the comparison value- Gibt zurück:
- a numeric comparison of the two values
-
byteValue
public byte byteValue()Returns the value of this NumberKey as a byte. This value is subject to the conversion rules set out inNumber.byteValue()- Gibt zurück:
- the NumberKey converted to a byte
-
intValue
public int intValue()Returns the value of this NumberKey as an int. This value is subject to the conversion rules set out inBigDecimal.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.- Gibt zurück:
- the NumberKey converted to an int
-
shortValue
public short shortValue()Returns the value of this NumberKey as a short. This value is subject to the conversion rules set out inBigDecimal.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.- Gibt zurück:
- the NumberKey converted to a short
-
longValue
public long longValue()Returns the value of this NumberKey as a long. This value is subject to the conversion rules set out inBigDecimal.intValue()- Gibt zurück:
- the NumberKey converted to a long
-
floatValue
public float floatValue()Returns the value of this NumberKey as a float. This value is subject to the conversion rules set out inBigDecimal.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.- Gibt zurück:
- the NumberKey converted to a float
-
doubleValue
public double doubleValue()Returns the value of this NumberKey as a double. This value is subject to the conversion rules set out inBigDecimal.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.- Gibt zurück:
- the NumberKey converted to a double
-