T
- the class of instances that are serialized into the databasepublic static class DatabaseStorage.FixedValueColumnConvertor<T> extends java.lang.Object implements DatabaseStorage.SearchableColumnConvertor<T,T>
Constructor and Description |
---|
DatabaseStorage.FixedValueColumnConvertor(T value,
boolean filterSearch)
Creates a new fixed-value column convertor.
|
Modifier and Type | Method and Description |
---|---|
T |
convertFromColumnValue(T value,
java.lang.Object column)
Returns an instance of object from the database column value.
|
java.lang.Object |
convertKeyToColumnValue(T key)
Returns a column value that can be used to search inside the database.
|
java.lang.Object |
convertToColumnValue(T instance)
Returns a value that can be stored in a database column for the given instance.
|
boolean |
isColumnCompatible(IndexComparator<?,? super T> indexComparator)
Returns true if the instance created by this convertor is compatible
with the given index comparator.
|
boolean |
isConvertFromColumnUsed()
Returns whether the
convertFromColumnValue
method should be used when reading the object from the database. |
boolean |
isConvertToColumnUsed()
Returns whether the
convertToColumnValue
method should be used when writing the object to database. |
public DatabaseStorage.FixedValueColumnConvertor(T value, boolean filterSearch)
value
- the fixed value for the columnfilterSearch
- flag whether this column convertor is always used in searching as filterpublic java.lang.Object convertToColumnValue(T instance) throws BucketStorageException
DatabaseStorage.ColumnConvertor
convertToColumnValue
in interface DatabaseStorage.ColumnConvertor<T>
instance
- the object instance from which to create a database valueBucketStorageException
- if the value cannot be convertedpublic boolean isConvertToColumnUsed()
DatabaseStorage.ColumnConvertor
convertToColumnValue
method should be used when writing the object to database.isConvertToColumnUsed
in interface DatabaseStorage.ColumnConvertor<T>
public T convertFromColumnValue(T value, java.lang.Object column) throws BucketStorageException
DatabaseStorage.ColumnConvertor
value
, which can
be either replaced by a new value, modified by this method or left intact.convertFromColumnValue
in interface DatabaseStorage.ColumnConvertor<T>
value
- the instance created by previous column convertorscolumn
- the value of the column to convertBucketStorageException
- if the value cannot be convertedpublic boolean isConvertFromColumnUsed()
DatabaseStorage.ColumnConvertor
convertFromColumnValue
method should be used when reading the object from the database.isConvertFromColumnUsed
in interface DatabaseStorage.ColumnConvertor<T>
public boolean isColumnCompatible(IndexComparator<?,? super T> indexComparator)
DatabaseStorage.SearchableColumnConvertor
isColumnCompatible
in interface DatabaseStorage.SearchableColumnConvertor<T,T>
indexComparator
- the index comparator that is checked for compatibilitypublic java.lang.Object convertKeyToColumnValue(T key)
DatabaseStorage.SearchableColumnConvertor
convertKeyToColumnValue
in interface DatabaseStorage.SearchableColumnConvertor<T,T>
key
- the key from which to create a database value