Package org.jdbi.v3.core.codec
Interface Codec<T>
-
- All Known Implementing Classes:
PostgisCodec
@Alpha public interface Codec<T>
A Codec provides a convenient way for a bidirectional mapping of an attribute to a database column.Groups a
ColumnMapperand anArgumentmapping function for a given type.Alpha: this interface is still evolving! It might eventually replace the existing Mappers and Arguments.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.util.function.Function<T,Argument>getArgumentFunction()Returns aFunctionthat creates anArgumentto map an attribute value onto the database column.default java.util.function.Function<T,Argument>getArgumentFunction(ConfigRegistry configRegistry)Returns aFunctionthat creates anArgumentto map an attribute value onto the database column.default ColumnMapper<T>getColumnMapper()Returns aColumnMapperthat creates an attribute value from a database column.default ColumnMapper<T>getColumnMapper(ConfigRegistry configRegistry)Returns aColumnMapperthat creates an attribute value from a database column.
-
-
-
Method Detail
-
getColumnMapper
default ColumnMapper<T> getColumnMapper()
Returns aColumnMapperthat creates an attribute value from a database column.Either this method or
getColumnMapper(ConfigRegistry)must be implemented.
-
getColumnMapper
default ColumnMapper<T> getColumnMapper(ConfigRegistry configRegistry)
Returns aColumnMapperthat 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- TheConfigRegistrythat this argument belongs to.
-
getArgumentFunction
default java.util.function.Function<T,Argument> getArgumentFunction()
Returns aFunctionthat creates anArgumentto map an attribute value onto the database column.Either this method or
getArgumentFunction(ConfigRegistry)must be implemented.
-
getArgumentFunction
default java.util.function.Function<T,Argument> getArgumentFunction(ConfigRegistry configRegistry)
Returns aFunctionthat creates anArgumentto 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- TheConfigRegistrythat this argument belongs to.
-
-