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 byteobjectToByte(Object object) Convert a boxed object or BigInteger into a byte.static intobjectToInt(Object object) Convert a boxed object or BigInteger into an integer.static longobjectToLong(Object object) Convert a boxed object or BigInteger into a long.static shortobjectToShort(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_BYTEis 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_SHORTis 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_INTis 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_LONGis returned.- Parameters:
object- the object to convert.- Returns:
- a long representation of object
-