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
Constructors -
Method Summary
Modifier and TypeMethodDescription<TYPE> TaddMapper(DbMapper<TYPE> dbMapper, GenericType<TYPE> mappedType) Add a custom mapper with generic types support.<TYPE> TAdd 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 DbClientdoBuild()GetMappermanager.mapperManager(MapperManager manager) Mapper manager for generic mapping, such as mapping of parameters to expected types.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:BuilderBuild the instance from this builder. -
doBuild
- Returns:
- new client
-
config
Description copied from interface:DbClientBuilderUse database connection configuration from configuration file.- Specified by:
configin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
config-Configinstance with database connection attributes- Returns:
- database provider builder
-
url
Description copied from interface:DbClientBuilderSet database connection string (URL).- Specified by:
urlin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
url- database connection string- Returns:
- database provider builder
-
username
Description copied from interface:DbClientBuilderSet database connection username.- Specified by:
usernamein interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
username- database connection user name- Returns:
- database provider builder
-
password
Description copied from interface:DbClientBuilderSet database connection password.- Specified by:
passwordin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
password- database connection password- Returns:
- database provider builder
-
statements
Description copied from interface:DbClientBuilderStatements to use either from configuration or manually configured.- Specified by:
statementsin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
statements- Statements to use- Returns:
- updated builder instance
-
addMapper
Description copied from interface:DbClientBuilderAdd a custom mapper.- Specified by:
addMapperin 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:DbClientBuilderAdd a custom mapper with generic types support.- Specified by:
addMapperin 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:DbClientBuilderMapper manager for generic mapping, such as mapping of parameters to expected types.- Specified by:
mapperManagerin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
manager- mapper manager- Returns:
- updated builder instance
-
dbMapperManager
Description copied from interface:DbClientBuilderMapper manager of all configuredmappers.- Specified by:
dbMapperManagerin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
manager- mapper manager- Returns:
- updated builder instance
-
addMapperProvider
Description copied from interface:DbClientBuilderDatabase schema mappers provider.- Specified by:
addMapperProviderin interfaceDbClientBuilder<T extends DbClientBuilderBase<T>>- Parameters:
provider- database schema mappers provider to use- Returns:
- updated builder instance
-
addService
Description copied from interface:DbClientBuilderAdd an interceptor. This allows to add implementation of tracing, metrics, logging etc. without the need to hard-code these into the base.- Specified by:
addServicein 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.
-
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
GetMappermanager.- Returns:
Mappermanager.
-
dbMapperManager
Get manager of all configuredmappers.- Returns:
- manager of all configured
mappers
-