Class NumericCast

java.lang.Object
com.illumon.iris.db.util.NumericCast

public final class NumericCast
extends Object
Utility functions for converting an arbitrary boxed integral Number into a primitive int or long.
  • Method Details

    • objectToByte

      public static byte objectToByte​(Object object)
      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

      public static short objectToShort​(Object object)
      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

      public static int objectToInt​(Object object)
      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

      public static long objectToLong​(Object object)
      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