- Type Parameters:
T
- target mapping type
- All Known Implementing Classes:
JsonProcessingMapper
public interface DbMapper<T>
A mapper to map database objects to/from a specific type.
Mappers can be either provided through DbClientProvider
or registered directly
with the DbClientBuilder.addMapper(DbMapper, Class)
.
-
Method Summary
Modifier and TypeMethodDescriptionRead database row and convert it to target type instance.List
<?> toIndexedParameters
(T value) Convert target type instance to a statement indexed parameters list.toNamedParameters
(T value) Convert target type instance to a statement named parameters map.
-
Method Details
-
read
Read database row and convert it to target type instance.- Parameters:
row
- source database row- Returns:
- target type instance containing database row
-
toNamedParameters
Convert target type instance to a statement named parameters map.- Parameters:
value
- mapping type instance containing values to be set into statement- Returns:
- map of statement named parameters mapped to values to be set
- See Also:
-
toIndexedParameters
Convert target type instance to a statement indexed parameters list.Using indexed parameters with typed values is probably not going to work nicely, unless the order is specified and the number of parameters is always related the provided value. There are cases where this is useful though - e.g. for types that represent an iterable collection.
- Parameters:
value
- mapping type instance containing values to be set into statement- Returns:
- map of statement named parameters mapped to values to be set
- See Also:
-