public interface DataHandler extends ParameterSetter, PropertyReader
PropertyReader
, ParameterSetter
, and InitialValueFactory
functional interfaces. This forces implementing classes to write the conversion between/from
SQL supported values and BaseDataType
in the same location, as well as an interpreter
for legacy initial value strings.Modifier and Type | Method and Description |
---|---|
default BaseDataType |
convert(java.lang.Object sqlVal)
Converts to and returns a
BaseDataType from a SQL value. |
BaseDataType |
getField(Record r,
int offset)
Obtain the value of the property of a
Record located at a specified offset in data
array. |
default int |
getFieldSizeInIndex(java.lang.Object val)
Compute the size in bytes taken by a specified value for the data type handled by this
class.
|
default java.lang.Object |
initialValue(java.lang.String text,
PropertyMeta meta)
Instantiate a low-level initial value suitable for storage in a
BaseRecord 's data
array, parsed from a string representation. |
void |
setField(java.lang.Object[] data,
BaseDataType val,
int offset,
PropertyMeta meta)
Sets a value of a property in a
Record . |
setParameter
readProperty
default java.lang.Object initialValue(java.lang.String text, PropertyMeta meta)
BaseRecord
's data
array, parsed from a string representation.text
- String representation of the initial value.meta
- Property metadata.java.lang.UnsupportedOperationException
- in the default implementation. All concrete, leaf, base data types which can be the
actual data type of a converted record field must override this implementation.default BaseDataType convert(java.lang.Object sqlVal)
BaseDataType
from a SQL value.sqlVal
- A value obtained from a SQL query, which needs to be converted to a
BaseDataType
.BaseDataType
, or null
if conversion is not possible.default int getFieldSizeInIndex(java.lang.Object val)
val
- The value to be computed the size.val
object occupies.void setField(java.lang.Object[] data, BaseDataType val, int offset, PropertyMeta meta)
Record
. The specified value is converted from
BaseDataType
FWD standard to plain Java, as the data
array expects before
assigning the value to right offset.data
- The data
array of the record to be altered.val
- The BaseDataType
value to be set.offset
- The offset of the property, ie, the entry in data
array. This includes both
base property offset and the eventual extent index.meta
- Property metadata. Used to fine-tune stored data.BaseDataType getField(Record r, int offset)
Record
located at a specified offset in data
array. It assumes the data at specified offset is compatible with this data handler.r
- The Record
.offset
- The offset.BaseDataType
.