public static class DatabaseStorage.ParametricColumnConvertor extends java.lang.Object implements DatabaseStorage.SearchableColumnConvertor<java.lang.Object,ModifiableParametric>
ModifiableParametric
value to decompose/restore
a given object to/from a database storage.Constructor and Description |
---|
DatabaseStorage.ParametricColumnConvertor(java.lang.String parameterName,
boolean usedToRead,
boolean usedToWrite,
boolean removeParameterOnWrite)
Creates a new instance of ParametricColumnConvertor.
|
Modifier and Type | Method and Description |
---|---|
ModifiableParametric |
convertFromColumnValue(ModifiableParametric value,
java.lang.Object column)
Returns an instance of object from the database column value.
|
java.lang.Object |
convertKeyToColumnValue(java.lang.Object key)
Returns a column value that can be used to search inside the database.
|
java.lang.Object |
convertToColumnValue(ModifiableParametric instance)
Returns a value that can be stored in a database column for the given instance.
|
boolean |
isColumnCompatible(IndexComparator<?,? super ModifiableParametric> 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.ParametricColumnConvertor(java.lang.String parameterName, boolean usedToRead, boolean usedToWrite, boolean removeParameterOnWrite) throws java.lang.IllegalArgumentException
parameterName
- the name of the Parametric
value to work withusedToRead
- 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 storageremoveParameterOnWrite
- a flag whether to remove the parameter value from the original object once the data are stored to the databasejava.lang.IllegalArgumentException
public java.lang.Object convertToColumnValue(ModifiableParametric instance) throws BucketStorageException
DatabaseStorage.ColumnConvertor
convertToColumnValue
in interface DatabaseStorage.ColumnConvertor<ModifiableParametric>
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<ModifiableParametric>
public ModifiableParametric convertFromColumnValue(ModifiableParametric 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<ModifiableParametric>
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<ModifiableParametric>
public boolean isColumnCompatible(IndexComparator<?,? super ModifiableParametric> indexComparator)
DatabaseStorage.SearchableColumnConvertor
isColumnCompatible
in interface DatabaseStorage.SearchableColumnConvertor<java.lang.Object,ModifiableParametric>
indexComparator
- the index comparator that is checked for compatibilitypublic java.lang.Object convertKeyToColumnValue(java.lang.Object key)
DatabaseStorage.SearchableColumnConvertor
convertKeyToColumnValue
in interface DatabaseStorage.SearchableColumnConvertor<java.lang.Object,ModifiableParametric>
key
- the key from which to create a database value