- java.lang.Object
-
- io.helidon.dbclient.jdbc.JdbcDbClientProviderBuilder
-
- All Implemented Interfaces:
Builder<DbClient>
,DbClientProviderBuilder<JdbcDbClientProviderBuilder>
,Supplier<DbClient>
public final class JdbcDbClientProviderBuilder extends Object implements DbClientProviderBuilder<JdbcDbClientProviderBuilder>
Fluent API builder forJdbcDbClientProviderBuilder
that implements theDbClientProviderBuilder
from Helidon DB API.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <TYPE> JdbcDbClientProviderBuilder
addMapper(DbMapper<TYPE> dbMapper, GenericType<TYPE> mappedType)
Add a custom mapper with generic types support.<TYPE> JdbcDbClientProviderBuilder
addMapper(DbMapper<TYPE> dbMapper, Class<TYPE> mappedClass)
Add a custom mapper.JdbcDbClientProviderBuilder
addMapperProvider(DbMapperProvider provider)
Database schema mappers provider.JdbcDbClientProviderBuilder
addService(DbClientService clientService)
Add an interceptor.DbClient
build()
Build database handler for specific provider.JdbcDbClientProviderBuilder
config(Config config)
Use database connection configuration from configuration file.JdbcDbClientProviderBuilder
connectionPool(ConnectionPool connectionPool)
Configure a connection pool.static JdbcDbClientProviderBuilder
create()
Create a new fluent API builder for JDBC specific db client builder.JdbcDbClientProviderBuilder
executorService(Supplier<ExecutorService> executorServiceSupplier)
Configure an explicit executor service supplier.JdbcDbClientProviderBuilder
mapperManager(MapperManager manager)
Mapper manager for generic mapping, such as mapping of parameters to expected types.JdbcDbClientProviderBuilder
password(String password)
Set database connection p¨assword.JdbcDbClientProviderBuilder
statements(DbStatements statements)
Statements to use either from configuration or manually configured.JdbcDbClientProviderBuilder
url(String url)
Set database connection string (URL).JdbcDbClientProviderBuilder
username(String username)
Set database connection user name.
-
-
-
Method Detail
-
create
public static JdbcDbClientProviderBuilder create()
Create a new fluent API builder for JDBC specific db client builder.- Returns:
- a new instance of the builder
-
build
public DbClient build()
Description copied from interface:DbClientProviderBuilder
Build database handler for specific provider.- Specified by:
build
in interfaceBuilder<DbClient>
- Specified by:
build
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Returns:
- database handler instance
-
config
public JdbcDbClientProviderBuilder config(Config config)
Description copied from interface:DbClientProviderBuilder
Use database connection configuration from configuration file.- Specified by:
config
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
config
-Config
instance with database connection attributes- Returns:
- database provider builder
-
connectionPool
public JdbcDbClientProviderBuilder connectionPool(ConnectionPool connectionPool)
Configure a connection pool.- Parameters:
connectionPool
- connection pool to get connections to a database- Returns:
- updated builder instance
-
executorService
public JdbcDbClientProviderBuilder executorService(Supplier<ExecutorService> executorServiceSupplier)
Configure an explicit executor service supplier. The executor service is used to execute blocking calls to a database.- Parameters:
executorServiceSupplier
- supplier to obtain an executor service from- Returns:
- updated builder instance
-
url
public JdbcDbClientProviderBuilder url(String url)
Description copied from interface:DbClientProviderBuilder
Set database connection string (URL).- Specified by:
url
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
url
- database connection string- Returns:
- database provider builder
-
username
public JdbcDbClientProviderBuilder username(String username)
Description copied from interface:DbClientProviderBuilder
Set database connection user name.- Specified by:
username
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
username
- database connection user name- Returns:
- database provider builder
-
password
public JdbcDbClientProviderBuilder password(String password)
Description copied from interface:DbClientProviderBuilder
Set database connection p¨assword.- Specified by:
password
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
password
- database connection password- Returns:
- database provider builder
-
statements
public JdbcDbClientProviderBuilder statements(DbStatements statements)
Description copied from interface:DbClientProviderBuilder
Statements to use either from configuration or manually configured.- Specified by:
statements
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
statements
- Statements to use- Returns:
- updated builder instance
-
addMapper
public <TYPE> JdbcDbClientProviderBuilder addMapper(DbMapper<TYPE> dbMapper, Class<TYPE> mappedClass)
Description copied from interface:DbClientProviderBuilder
Add a custom mapper.- Specified by:
addMapper
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Type Parameters:
TYPE
- type of the supported class- Parameters:
dbMapper
- the mapper capable of mapping the mappedClass to various database objectsmappedClass
- class that this mapper supports- Returns:
- updated builder instance.
-
addMapper
public <TYPE> JdbcDbClientProviderBuilder addMapper(DbMapper<TYPE> dbMapper, GenericType<TYPE> mappedType)
Description copied from interface:DbClientProviderBuilder
Add a custom mapper with generic types support.- Specified by:
addMapper
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Type Parameters:
TYPE
- type of the supported class- Parameters:
dbMapper
- the mapper capable of mapping the mappedClass to various database objectsmappedType
- type that this mapper supports- Returns:
- updated builder instance.
-
mapperManager
public JdbcDbClientProviderBuilder mapperManager(MapperManager manager)
Description copied from interface:DbClientProviderBuilder
Mapper manager for generic mapping, such as mapping of parameters to expected types.- Specified by:
mapperManager
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
manager
- mapper manager- Returns:
- updated builder instance
-
addMapperProvider
public JdbcDbClientProviderBuilder addMapperProvider(DbMapperProvider provider)
Description copied from interface:DbClientProviderBuilder
Database schema mappers provider.- Specified by:
addMapperProvider
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
provider
- database schema mappers provider to use- Returns:
- updated builder instance
-
addService
public JdbcDbClientProviderBuilder addService(DbClientService clientService)
Description copied from interface:DbClientProviderBuilder
Add an interceptor. This allows to add implementation of tracing, metrics, logging etc. without the need to hard-code these into the base.- Specified by:
addService
in interfaceDbClientProviderBuilder<JdbcDbClientProviderBuilder>
- Parameters:
clientService
- interceptor instance- Returns:
- updated builder instance
-
-