Package com.illumon.iris.db.util
Class NumericCast
java.lang.Object
com.illumon.iris.db.util.NumericCast
Utility functions for converting an arbitrary boxed integral Number into a primitive int or long.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte
objectToByte
(Object object) Convert a boxed object or BigInteger into a byte.static int
objectToInt
(Object object) Convert a boxed object or BigInteger into an integer.static long
objectToLong
(Object object) Convert a boxed object or BigInteger into a long.static short
objectToShort
(Object object) Convert a boxed object or BigInteger into a short.
-
Method Details
-
objectToByte
Convert a boxed object or BigInteger into a byte.If the number does not fit into a byte, then an exception is thrown. If the input is a Deephaven null, then
QueryConstants.NULL_BYTE
is returned.- Parameters:
object
- the object to convert.- Returns:
- an byte representation of object
-
objectToShort
Convert a boxed object or BigInteger into a short.If the number does not fit into an short, then an exception is thrown. If the input is a Deephaven null, then
QueryConstants.NULL_SHORT
is returned.- Parameters:
object
- the object to convert.- Returns:
- a short representation of object
-
objectToInt
Convert a boxed object or BigInteger into an integer.If the number does not fit into an int, then an exception is thrown. If the input is a Deephaven null, then
QueryConstants.NULL_INT
is returned.- Parameters:
object
- the object to convert.- Returns:
- an int representation of object
-
objectToLong
Convert a boxed object or BigInteger into a long.If the number does not fit into a long, then an exception is thrown. If the input is a Deephaven null, then
QueryConstants.NULL_LONG
is returned.- Parameters:
object
- the object to convert.- Returns:
- a long representation of object
-