Module io.helidon.dbclient
Package io.helidon.dbclient
Class DbClientBuilderBase<T extends DbClientBuilderBase<T>>
java.lang.Object
io.helidon.dbclient.DbClientBuilderBase<T>
- Type Parameters:
T
- type of builder subclass
- All Implemented Interfaces:
Builder<T,
,DbClient> DbClientBuilder<T>
,Supplier<DbClient>
- Direct Known Subclasses:
JdbcClientBuilder
,MongoDbClientBuilder
public abstract class DbClientBuilderBase<T extends DbClientBuilderBase<T>>
extends Object
implements DbClientBuilder<T>
Base
DbClientBuilder
implementation.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<TYPE> T
addMapper
(DbMapper<TYPE> dbMapper, GenericType<TYPE> mappedType) Add a custom mapper with generic types support.<TYPE> T
Add a custom mapper.addMapperProvider
(DbMapperProvider provider) Database schema mappers provider.addService
(DbClientService clientService) Add an interceptor.build()
Build the instance from this builder.Get configured client services (interceptors).Use database connection configuration from configuration file.Get manager of all configuredmappers
.dbMapperManager
(DbMapperManager manager) Mapper manager of all configuredmappers
.protected abstract DbClient
doBuild()
GetMapper
manager.mapperManager
(MapperManager manager) Mapper manager for generic mapping, such as mapping of parameters to expected types.boolean
Configured missing values in named parametersMap
handling.missingMapParametersAsNull
(boolean missingMapParametersAsNull) Missing values in named parametersMap
are considered as null values.password()
Get database user password.Set database connection password.Get configured statements to be used by database provider.statements
(DbStatements statements) Statements to use either from configuration or manually configured.url()
Get database URL.Set database connection string (URL).username()
Get database user name.Set database connection username.
-
Constructor Details
-
DbClientBuilderBase
protected DbClientBuilderBase()Creates an instance ofDbClientBuilderBase
.
-
-
Method Details
-
build
Description copied from interface:Builder
Build the instance from this builder. -
doBuild
- Returns:
- new client
-
config
Description copied from interface:DbClientBuilder
Use database connection configuration from configuration file.- Specified by:
config
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
config
-Config
instance with database connection attributes- Returns:
- database provider builder
-
url
Description copied from interface:DbClientBuilder
Set database connection string (URL).- Specified by:
url
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
url
- database connection string- Returns:
- database provider builder
-
username
Description copied from interface:DbClientBuilder
Set database connection username.- Specified by:
username
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
username
- database connection user name- Returns:
- database provider builder
-
password
Description copied from interface:DbClientBuilder
Set database connection password.- Specified by:
password
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
password
- database connection password- Returns:
- database provider builder
-
missingMapParametersAsNull
Description copied from interface:DbClientBuilder
Missing values in named parametersMap
are considered as null values. When set totrue
, named parameters value missing in theMap
is considered asnull
. When set tofalse
, any parameter value missing in theMap
will cause an exception.- Specified by:
missingMapParametersAsNull
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
missingMapParametersAsNull
- whether missing values in named parametersMap
are considered as null values- Returns:
- updated builder instance
-
statements
Description copied from interface:DbClientBuilder
Statements to use either from configuration or manually configured.- Specified by:
statements
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
statements
- Statements to use- Returns:
- updated builder instance
-
addMapper
Description copied from interface:DbClientBuilder
Add a custom mapper.- Specified by:
addMapper
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- 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
Description copied from interface:DbClientBuilder
Add a custom mapper with generic types support.- Specified by:
addMapper
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- 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
Description copied from interface:DbClientBuilder
Mapper manager for generic mapping, such as mapping of parameters to expected types.- Specified by:
mapperManager
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
manager
- mapper manager- Returns:
- updated builder instance
-
dbMapperManager
Description copied from interface:DbClientBuilder
Mapper manager of all configuredmappers
.- Specified by:
dbMapperManager
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
manager
- mapper manager- Returns:
- updated builder instance
-
addMapperProvider
Description copied from interface:DbClientBuilder
Database schema mappers provider.- Specified by:
addMapperProvider
in interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
provider
- database schema mappers provider to use- Returns:
- updated builder instance
-
addService
Description copied from interface:DbClientBuilder
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 interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>
- Parameters:
clientService
- interceptor instance- Returns:
- updated builder instance
-
url
Get database URL.- Returns:
- database URL
-
username
Get database user name.- Returns:
- database user name
-
password
Get database user password.- Returns:
- database user password.
-
missingMapParametersAsNull
public boolean missingMapParametersAsNull()Configured missing values in named parametersMap
handling.- Returns:
- when set to
true
, named parameters value missing in theMap
is considered asnull
, when set tofalse
, any parameter value missing in theMap
will cause an exception.
-
statements
Get configured statements to be used by database provider.- Returns:
- statements to be used by database provider
-
clientServices
Get configured client services (interceptors). List of services is converted to unmodifiable List.- Returns:
- client services
-
mapperManager
GetMapper
manager.- Returns:
Mapper
manager.
-
dbMapperManager
Get manager of all configuredmappers
.- Returns:
- manager of all configured
mappers
-