Interface TypeConverter<ObjectT,ColumnT>

Type Parameters:
ObjectT - Object type.
ColumnT - Column type.

public interface TypeConverter<ObjectT,ColumnT>
Type converter interface provides methods for additional data transformation of the field type to a type compatible with the column type, and vice versa.

The converter can be used to convert objects (or their fields) whose type is incompatible with the schema. E.g., serialize an arbitrary object to a byte[] for storing is a BLOB column.

  • Method Summary

    Modifier and Type
    Method
    Description
    Converts a given object to a column type.
    Transforms to an object of the target type; called after the data is read from a column.
  • Method Details

    • toColumnType

      ColumnT toColumnType(ObjectT obj) throws Exception
      Converts a given object to a column type.
      Parameters:
      obj - Object to transform.
      Returns:
      Object of column type.
      Throws:
      Exception - If transformation failed.
    • toObjectType

      ObjectT toObjectType(ColumnT data) throws Exception
      Transforms to an object of the target type; called after the data is read from a column.
      Parameters:
      data - Column data.
      Returns:
      Object of the target type.
      Throws:
      Exception - If transformation failed.