Class ReinterpretUtilities

java.lang.Object
com.illumon.iris.db.v2.sources.ReinterpretUtilities

public class ReinterpretUtilities
extends Object
  • Constructor Details

  • Method Details

    • instantToLongSource

      @NotNull public static ColumnSource<Long> instantToLongSource​(@NotNull ColumnSource<?> source)
      Given an Instant column source turn it into a long column source, either via reinterpretation or wrapping.
      Parameters:
      source - the source to turn into a long source
      Returns:
      the long source
    • zonedDateTimeToLongSource

      @NotNull public static ColumnSource<Long> zonedDateTimeToLongSource​(@NotNull ColumnSource<?> source)
      Given a ZonedDateTime column source turn it into a long column source, either via reinterpretation or wrapping.
      Parameters:
      source - the source to turn into a long source
      Returns:
      the long source
    • dateTimeToLongSource

      public static ColumnSource<Long> dateTimeToLongSource​(ColumnSource<?> source)
      Given a DateTime column source turn it into a long column source, either via reinterpretation or wrapping.
      Parameters:
      source - the source to turn into a long source
      Returns:
      the long source
    • booleanToByteSource

      public static ColumnSource<Byte> booleanToByteSource​(ColumnSource<?> source)
      Given a Boolean column source turn it into a byte column source, either via reinterpretation or wrapping.
      Parameters:
      source - the source to turn into a byte source
      Returns:
      the byte source
    • maybeConvertToPrimitive

      public static ColumnSource<?> maybeConvertToPrimitive​(ColumnSource<?> source)
      If source is something that we prefer to handle as a primitive, do the appropriate conversion.
      Parameters:
      source - The source to convert
      Returns:
      If possible, the source converted to a primitive, otherwise the source
    • convertToOriginal

      public static ColumnSource<?> convertToOriginal​(@NotNull Class<?> originalType, @NotNull ColumnSource<?> source)
      Reinterpret or box ColumnSource back to its original type.
      Parameters:
      originalType - The type to convert to
      source - The source to convert
      Returns:
      Reinterpret or box source back to the original type if possible