Package com.illumon.iris.db.tables
Class CodecLookup
java.lang.Object
com.illumon.iris.db.tables.CodecLookup
public class CodecLookup extends Object
Utility class to concentrate
ObjectCodec
lookups.-
Constructor Summary
Constructors Constructor Description CodecLookup()
-
Method Summary
Modifier and Type Method Description static boolean
codecRequired(com.illumon.dataobjects.ColumnDefinition<?> columnDefinition)
Test whether a codec is required to write or read the suppliedColumnDefinition
.static boolean
codecRequired(Class<?> dataType, Class<?> componentType)
Test whether a codec is required to write or read the supplied types.static boolean
explicitCodecPresent(String codecClassName)
Test whether an explicit codec has been set.static <TYPE> ObjectCodec<TYPE>
getDefaultCodec(Class<TYPE> dataType)
Get the default codec for the supplied data type.static <TYPE> ObjectCodec<TYPE>
lookup(com.illumon.dataobjects.ColumnDefinition<TYPE> columnDefinition, ColumnToCodecMappings... codecMappings)
Lookup anObjectCodec
for the suppliedColumnDefinition
.static <TYPE> ObjectCodec<TYPE>
lookup(Class<TYPE> dataType, String codecClassName, String codecArguments)
Lookup anObjectCodec
for the supplied data type, codec class name, and arguments.
-
Constructor Details
-
CodecLookup
public CodecLookup()
-
-
Method Details
-
codecRequired
public static boolean codecRequired(@NotNull com.illumon.dataobjects.ColumnDefinition<?> columnDefinition)Test whether a codec is required to write or read the suppliedColumnDefinition
.- Parameters:
columnDefinition
- TheColumnDefinition
- Returns:
- Whether a codec is required
-
codecRequired
Test whether a codec is required to write or read the supplied types.- Parameters:
dataType
- The data type to checkcomponentType
- The component type to check, for array andDbArray
types- Returns:
- Whether a codec is required
-
explicitCodecPresent
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 anObjectCodec
for the suppliedColumnDefinition
. Assumes that the data type is appropriate for use with a codec, i.e. thatcodecRequired(Class, Class)
will return false.- Parameters:
columnDefinition
- TheColumnDefinition
- Returns:
- The
ObjectCodec
-
lookup
public static <TYPE> ObjectCodec<TYPE> lookup(@NotNull Class<TYPE> dataType, String codecClassName, String codecArguments)Lookup anObjectCodec
for the supplied data type, codec class name, and arguments. Assumes that the data type is appropriate for use with a codec, i.e. thatcodecRequired(Class, Class)
will return false.- Parameters:
dataType
- The data typecodecClassName
- The codec class namecodecArguments
- The codec arguments in string form- Returns:
- The
ObjectCodec
-
getDefaultCodec
Get the default codec for the supplied data type.- Parameters:
dataType
- The data type- Returns:
- The default
ObjectCodec
-