Class CodecLookup

java.lang.Object
com.illumon.iris.db.tables.CodecLookup

public class CodecLookup
extends Object
Utility class to concentrate ObjectCodec lookups.
  • Constructor Details

  • Method Details

    • codecRequired

      public static boolean codecRequired​(@NotNull com.illumon.dataobjects.ColumnDefinition<?> columnDefinition)
      Test whether a codec is required to write or read the supplied ColumnDefinition.
      Parameters:
      columnDefinition - The ColumnDefinition
      Returns:
      Whether a codec is required
    • codecRequired

      public static boolean codecRequired​(@NotNull Class<?> dataType, @Nullable Class<?> componentType)
      Test whether a codec is required to write or read the supplied types.
      Parameters:
      dataType - The data type to check
      componentType - The component type to check, for array and DbArray types
      Returns:
      Whether a codec is required
    • explicitCodecPresent

      public static boolean explicitCodecPresent​(String codecClassName)
      Test whether an explicit codec has been set.
      Parameters:
      codecClassName - The codec class name
      Returns:
      Whether an explicit codec has been set
    • lookup

      public static <TYPE> ObjectCodec<TYPE> lookup​(@NotNull com.illumon.dataobjects.ColumnDefinition<TYPE> columnDefinition, @NotNull ColumnToCodecMappings... codecMappings)
      Lookup an ObjectCodec for the supplied ColumnDefinition. Assumes that the data type is appropriate for use with a codec, i.e. that codecRequired(Class, Class) will return false.
      Parameters:
      columnDefinition - The ColumnDefinition
      Returns:
      The ObjectCodec
    • lookup

      public static <TYPE> ObjectCodec<TYPE> lookup​(@NotNull Class<TYPE> dataType, String codecClassName, String codecArguments)
      Lookup an ObjectCodec for the supplied data type, codec class name, and arguments. Assumes that the data type is appropriate for use with a codec, i.e. that codecRequired(Class, Class) will return false.
      Parameters:
      dataType - The data type
      codecClassName - The codec class name
      codecArguments - The codec arguments in string form
      Returns:
      The ObjectCodec
    • getDefaultCodec

      public static <TYPE> ObjectCodec<TYPE> getDefaultCodec​(@NotNull Class<TYPE> dataType)
      Get the default codec for the supplied data type.
      Parameters:
      dataType - The data type
      Returns:
      The default ObjectCodec