messif.buckets.storage.impl
Interface DatabaseStorage.ColumnConvertor<T>

Type Parameters:
T - the type of the instance that is stored/read from the database column
All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
DatabaseStorage.BinarySerializableColumnConvertor
Enclosing class:
DatabaseStorage<T>

public static interface DatabaseStorage.ColumnConvertor<T>
extends java.io.Serializable

Provides a conversion between database column data and object instances.


Method Summary
 T convertFromColumnValue(T value, java.lang.Object column)
          Returns an instance of object from the database column value.
 java.lang.Object convertToColumnValue(T instance)
          Returns a value that can be stored in a database column for the given instance.
 boolean isColumnCompatible(IndexComparator<?,?> indexComparator)
          Returns true if the instance created by this convertor is compatible with the given index comparator.
 

Method Detail

convertToColumnValue

java.lang.Object convertToColumnValue(T instance)
                                      throws BucketStorageException
Returns a value that can be stored in a database column for the given instance.

Parameters:
instance - the object instance from which to create a database value
Returns:
a database value
Throws:
BucketStorageException - if the value cannot be converted

convertFromColumnValue

T convertFromColumnValue(T value,
                         java.lang.Object column)
                         throws BucketStorageException
Returns an instance of object from the database column value. A value created by previous columns is provided in value, which can be either replaced by a new value, modified by this method or left intact.

Parameters:
value - the instance created by previous column convertors
column - the value of the column to convert
Returns:
an instance created from the column value
Throws:
BucketStorageException - if the value cannot be converted

isColumnCompatible

boolean isColumnCompatible(IndexComparator<?,?> indexComparator)
Returns true if the instance created by this convertor is compatible with the given index comparator.

Parameters:
indexComparator - the index comparator that is checked for compatibility
Returns:
true if this column convertor works with compatible instances