Module io.helidon.dbclient.mongodb
Package io.helidon.dbclient.mongodb
Class MongoDbClientProviderBuilder
- java.lang.Object
-
- io.helidon.dbclient.mongodb.MongoDbClientProviderBuilder
-
- All Implemented Interfaces:
Builder<DbClient>
,DbClientProviderBuilder<MongoDbClientProviderBuilder>
,Supplier<DbClient>
public final class MongoDbClientProviderBuilder extends Object implements DbClientProviderBuilder<MongoDbClientProviderBuilder>
Builder for mongoDB database.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <TYPE> MongoDbClientProviderBuilder
addMapper(DbMapper<TYPE> dbMapper, GenericType<TYPE> mappedType)
Add a custom mapper with generic types support.<TYPE> MongoDbClientProviderBuilder
addMapper(DbMapper<TYPE> dbMapper, Class<TYPE> mappedClass)
Add a custom mapper.MongoDbClientProviderBuilder
addMapperProvider(DbMapperProvider provider)
Database schema mappers provider.MongoDbClientProviderBuilder
addService(DbClientService clientService)
Add an interceptor.DbClient
build()
Build database handler for specific provider.MongoDbClientProviderBuilder
config(Config config)
Use database connection configuration from configuration file.MongoDbClientProviderBuilder
credDb(String db)
Credential database.MongoDbClientProviderBuilder
mapperManager(MapperManager manager)
Mapper manager for generic mapping, such as mapping of parameters to expected types.MongoDbClientProviderBuilder
password(String password)
Set database connection p¨assword.MongoDbClientProviderBuilder
statements(DbStatements statements)
Statements to use either from configuration or manually configured.MongoDbClientProviderBuilder
url(String url)
Set database connection string (URL).MongoDbClientProviderBuilder
username(String username)
Set database connection user name.
-
-
-
Method Detail
-
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<MongoDbClientProviderBuilder>
- Returns:
- database handler instance
-
config
public MongoDbClientProviderBuilder config(Config config)
Description copied from interface:DbClientProviderBuilder
Use database connection configuration from configuration file.- Specified by:
config
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- Parameters:
config
-Config
instance with database connection attributes- Returns:
- database provider builder
-
url
public MongoDbClientProviderBuilder url(String url)
Description copied from interface:DbClientProviderBuilder
Set database connection string (URL).- Specified by:
url
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- Parameters:
url
- database connection string- Returns:
- database provider builder
-
username
public MongoDbClientProviderBuilder username(String username)
Description copied from interface:DbClientProviderBuilder
Set database connection user name.- Specified by:
username
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- Parameters:
username
- database connection user name- Returns:
- database provider builder
-
password
public MongoDbClientProviderBuilder password(String password)
Description copied from interface:DbClientProviderBuilder
Set database connection p¨assword.- Specified by:
password
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- Parameters:
password
- database connection password- Returns:
- database provider builder
-
credDb
public MongoDbClientProviderBuilder credDb(String db)
Credential database.- Parameters:
db
- database name- Returns:
- updated builder instance
-
statements
public MongoDbClientProviderBuilder statements(DbStatements statements)
Description copied from interface:DbClientProviderBuilder
Statements to use either from configuration or manually configured.- Specified by:
statements
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- Parameters:
statements
- Statements to use- Returns:
- updated builder instance
-
addService
public MongoDbClientProviderBuilder 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<MongoDbClientProviderBuilder>
- Parameters:
clientService
- interceptor instance- Returns:
- updated builder instance
-
addMapper
public <TYPE> MongoDbClientProviderBuilder addMapper(DbMapper<TYPE> dbMapper, Class<TYPE> mappedClass)
Description copied from interface:DbClientProviderBuilder
Add a custom mapper.- Specified by:
addMapper
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- 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> MongoDbClientProviderBuilder 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<MongoDbClientProviderBuilder>
- 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 MongoDbClientProviderBuilder 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<MongoDbClientProviderBuilder>
- Parameters:
manager
- mapper manager- Returns:
- updated builder instance
-
addMapperProvider
public MongoDbClientProviderBuilder addMapperProvider(DbMapperProvider provider)
Description copied from interface:DbClientProviderBuilder
Database schema mappers provider.- Specified by:
addMapperProvider
in interfaceDbClientProviderBuilder<MongoDbClientProviderBuilder>
- Parameters:
provider
- database schema mappers provider to use- Returns:
- updated builder instance
-
-