T
- the class of instances that are serialized into the databasepublic static class DatabaseStorage.LocalAbstractObjectTextStreamColumnConvertor<T extends LocalAbstractObject> extends java.lang.Object implements DatabaseStorage.ColumnConvertor<T>
T
are
serialized using write
method and deserialized using LocalAbstractObject.TextStreamFactory
.Constructor and Description |
---|
DatabaseStorage.LocalAbstractObjectTextStreamColumnConvertor(java.lang.Class<? extends T> storedObjectsClass)
Creates a new instance of LocalAbstractObjectTextStreamColumnConvertor.
|
DatabaseStorage.LocalAbstractObjectTextStreamColumnConvertor(java.lang.Class<? extends T> storedObjectsClass,
boolean usedToRead,
boolean usedToWrite,
java.lang.Object... additionalArguments)
Creates a new instance of LocalAbstractObjectTextStreamColumnConvertor.
|
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(LocalAbstractObject 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.LocalAbstractObjectTextStreamColumnConvertor(java.lang.Class<? extends T> storedObjectsClass, boolean usedToRead, boolean usedToWrite, java.lang.Object... additionalArguments)
storedObjectsClass
- the class of instances that are serialized by this column convertorusedToRead
- 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 storageadditionalArguments
- additional arguments for the constructorpublic DatabaseStorage.LocalAbstractObjectTextStreamColumnConvertor(java.lang.Class<? extends T> storedObjectsClass)
usedToRead
and usedToWrite
are both set to true.storedObjectsClass
- the class of instances that are serialized by this column convertorpublic java.lang.Object convertToColumnValue(LocalAbstractObject instance) throws BucketStorageException
DatabaseStorage.ColumnConvertor
convertToColumnValue
in interface DatabaseStorage.ColumnConvertor<T extends LocalAbstractObject>
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 extends LocalAbstractObject>
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 extends LocalAbstractObject>
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 extends LocalAbstractObject>