-
public interface DbMapperManager
Mapper manager of all configuredmappers
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DbMapperManager.Builder
Fluent API builder forDbMapperManager
.
-
Field Summary
Fields Modifier and Type Field Description static GenericType<DbRow>
TYPE_DB_ROW
Generic type for theDbRow
class.static GenericType<List<?>>
TYPE_INDEXED_PARAMS
Generic type for theList
of indexed parameters.static GenericType<Map<String,?>>
TYPE_NAMED_PARAMS
Generic type for theMap
of String to value pairs for named parameters.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DbMapperManager.Builder
builder()
Create a fluent API builder to configure the mapper manager.static DbMapperManager
create()
Create a new mapper manager from Java Service loader only.static DbMapperManager
create(HelidonServiceLoader<DbMapperProvider> serviceLoader)
Create a new mapper manager from customizedHelidonServiceLoader
.<T> T
read(DbRow row, GenericType<T> expectedType)
Read database row into a typed value.<T> T
read(DbRow row, Class<T> expectedType)
Read database row into a typed value.<T> List<?>
toIndexedParameters(T value, Class<T> valueClass)
Read object into a list of indexed parameters.<T> Map<String,?>
toNamedParameters(T value, Class<T> valueClass)
Read object into a map of named parameters.
-
-
-
Field Detail
-
TYPE_DB_ROW
static final GenericType<DbRow> TYPE_DB_ROW
Generic type for theDbRow
class.
-
TYPE_NAMED_PARAMS
static final GenericType<Map<String,?>> TYPE_NAMED_PARAMS
Generic type for theMap
of String to value pairs for named parameters.
-
TYPE_INDEXED_PARAMS
static final GenericType<List<?>> TYPE_INDEXED_PARAMS
Generic type for theList
of indexed parameters.
-
-
Method Detail
-
builder
static DbMapperManager.Builder builder()
Create a fluent API builder to configure the mapper manager.- Returns:
- a new builder instance
-
create
static DbMapperManager create()
Create a new mapper manager from Java Service loader only.- Returns:
- mapper manager
-
create
static DbMapperManager create(HelidonServiceLoader<DbMapperProvider> serviceLoader)
Create a new mapper manager from customizedHelidonServiceLoader
.- Parameters:
serviceLoader
- service loader to use to read allDbMapperProvider
- Returns:
- mapper manager
-
read
<T> T read(DbRow row, Class<T> expectedType) throws MapperException
Read database row into a typed value.- Type Parameters:
T
- type of the response- Parameters:
row
- row from a databaseexpectedType
- class of the response- Returns:
- instance with data from the row
- Throws:
MapperException
- in case the mapper was not found- See Also:
DbRow.as(Class)
-
read
<T> T read(DbRow row, GenericType<T> expectedType) throws MapperException
Read database row into a typed value.- Type Parameters:
T
- type of the response- Parameters:
row
- row from a databaseexpectedType
- generic type of the response- Returns:
- instance with data from the row
- Throws:
MapperException
- in case the mapper was not found- See Also:
DbRow.as(io.helidon.common.GenericType)
-
toNamedParameters
<T> Map<String,?> toNamedParameters(T value, Class<T> valueClass)
Read object into a map of named parameters.- Type Parameters:
T
- type of value- Parameters:
value
- the typed valuevalueClass
- type of the value object- Returns:
- map with the named parameters
- See Also:
DbStatement.namedParam(Object)
-
toIndexedParameters
<T> List<?> toIndexedParameters(T value, Class<T> valueClass)
Read object into a list of indexed parameters.- Type Parameters:
T
- type of value- Parameters:
value
- the typed valuevalueClass
- type of the value object- Returns:
- list with indexed parameters (in the order expected by statements using this object)
- See Also:
DbStatement.indexedParam(Object)
-
-