Package org.jdbi.v3.core.codec
Interface Codec<T>
A Codec provides a convenient way for a bidirectional mapping of an attribute to a database column.
Groups a ColumnMapper
and an Argument
mapping function for a given type.
Codec instances can replace existing Mapper and Argument pairs.
-
Method Summary
Modifier and TypeMethodDescriptiongetArgumentFunction
(ConfigRegistry configRegistry) default ColumnMapper
<T> Returns aColumnMapper
that creates an attribute value from a database column.default ColumnMapper
<T> getColumnMapper
(ConfigRegistry configRegistry) Returns aColumnMapper
that creates an attribute value from a database column.
-
Method Details
-
getColumnMapper
Returns aColumnMapper
that creates an attribute value from a database column.Either this method or
getColumnMapper(ConfigRegistry)
must be implemented. -
getColumnMapper
Returns aColumnMapper
that creates an attribute value from a database column.This method is optional. If it is not implemented, the result of
getColumnMapper()
is returned.- Parameters:
configRegistry
- TheConfigRegistry
that this argument belongs to.
-
getArgumentFunction
Returns aFunction
that creates anArgument
to map an attribute value onto the database column.Either this method or
getArgumentFunction(ConfigRegistry)
must be implemented. -
getArgumentFunction
Returns aFunction
that creates anArgument
to map an attribute value onto the database column.This method is optional. If it is not implemented, the result of
getArgumentFunction()
is returned.- Parameters:
configRegistry
- TheConfigRegistry
that this argument belongs to.
-