T
- the class of instances that are serialized into the databasepublic static class DatabaseStorage.BinarySerializableColumnConvertor<T> extends java.lang.Object implements DatabaseStorage.ColumnConvertor<T>
T
are
binary serialized/deserialized
.Constructor and Description |
---|
DatabaseStorage.BinarySerializableColumnConvertor(java.lang.Class<? extends T> storedObjectsClass,
BinarySerializator serializator)
Creates a new instance of BinarySerializableColumnConvertor.
|
DatabaseStorage.BinarySerializableColumnConvertor(java.lang.Class<? extends T> storedObjectsClass,
BinarySerializator serializator,
boolean usedToRead,
boolean usedToWrite)
Creates a new instance of BinarySerializableColumnConvertor.
|
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 |
convertToColumnValue(T instance)
Returns a value that can be stored in a database column for the given instance.
|
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.BinarySerializableColumnConvertor(java.lang.Class<? extends T> storedObjectsClass, BinarySerializator serializator, boolean usedToRead, boolean usedToWrite)
storedObjectsClass
- the class of instances that are serialized by this column convertorserializator
- the serializator that is used for storing/restoring the data into the databaseusedToRead
- a flag whether this column convertor is used (true) or should be skipped (false) when the object is retrieved from the storageusedToWrite
- a flag whether this column convertor is used (true) or should be skipped (false) when the object is stored into the storagepublic DatabaseStorage.BinarySerializableColumnConvertor(java.lang.Class<? extends T> storedObjectsClass, BinarySerializator serializator)
usedToRead
and usedToWrite
are both set to true.storedObjectsClass
- the class of instances that are serialized by this column convertorserializator
- the serializator that is used for storing/restoring the data into the databasepublic 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>