Class PrimitiveArrayConversionUtility

java.lang.Object
com.illumon.integrations.common.PrimitiveArrayConversionUtility

public class PrimitiveArrayConversionUtility extends Object
General purpose helper methods for array conversion methods from specific object types to/from primitive types. This is specifically intended to improve performance in integration with Python, where conversion of primitive type arrays involves direct copy of a memory buffer, and is much more performant than element-by-element inspection.
  • Constructor Details

    • PrimitiveArrayConversionUtility

      public PrimitiveArrayConversionUtility()
  • Method Details

    • translateArrayBooleanToByte

      public static byte[] translateArrayBooleanToByte(Boolean[] array)
      Translates a java.lang.Boolean array to a byte array. The mapping will be performed as null to -1, false to 0, and true to 1. This is the (psuedo)inverse of `translateArrayByteToBoolean`.
      Parameters:
      array - - the Boolean array
      Returns:
      the byte array
    • translateArrayByteToBoolean

      public static Boolean[] translateArrayByteToBoolean(byte[] array)
      Translates a byte array to a Boolean array. The mapping will be performed as <0 to null, 0 to false, >0 to true. This is the (psuedo)inverse of `translateArrayBooleanToByte`.
      Parameters:
      array - - the byte array
      Returns:
      the Boolean array
    • translateArrayDBDateTimeToLong

      public static long[] translateArrayDBDateTimeToLong(DBDateTime[] array)
      Translates a DBDateTime array to a long array. This is the (psuedo)inverse of `translateArrayLongToDBDateTime`.
      Parameters:
      array - - the DBDateTime array
      Returns:
      the corresponding long array
    • translateArrayLongToDBDateTime

      public static DBDateTime[] translateArrayLongToDBDateTime(long[] array)
      Translates a long array to a DBDateTime array. This is the (psuedo)inverse of `translateArrayLongToDBDateTime`.
      Parameters:
      array - - the long array
      Returns:
      the corresponding DBDateTime array