@NotThreadSafe public static final class MongoClientSettings.Builder extends Object
MongoClientSettings
so that MongoClientSettings
can be immutable, and to support easier construction
through chaining.Modifier and Type | Method | Description |
---|---|---|
MongoClientSettings.Builder |
addCommandListener(CommandListener commandListener) |
Adds the given command listener.
|
MongoClientSettings.Builder |
applicationName(String applicationName) |
Sets the logical name of the application using this MongoClient.
|
MongoClientSettings.Builder |
applyConnectionString(ConnectionString connectionString) |
Takes the settings from the given
ConnectionString and applies them to the builder |
MongoClientSettings |
build() |
Build an instance of
MongoClientSettings . |
MongoClientSettings.Builder |
codecRegistry(CodecRegistry codecRegistry) |
Sets the codec registry
|
MongoClientSettings.Builder |
commandListenerList(List<CommandListener> commandListeners) |
Sets the the command listeners
|
MongoClientSettings.Builder |
dbPath(String dbPath) |
Sets the dbPath for the mongod.
|
public MongoClientSettings.Builder applyConnectionString(ConnectionString connectionString)
ConnectionString
and applies them to the builderconnectionString
- the connection string containing details of how to connect to MongoDBpublic MongoClientSettings.Builder codecRegistry(CodecRegistry codecRegistry)
codecRegistry
- the codec registryMongoClientSettings.getCodecRegistry()
public MongoClientSettings.Builder addCommandListener(CommandListener commandListener)
commandListener
- the command listenerpublic MongoClientSettings.Builder commandListenerList(List<CommandListener> commandListeners)
commandListeners
- the list of command listenerspublic MongoClientSettings.Builder applicationName(String applicationName)
applicationName
- the logical name of the application using this MongoClient. It may be null.
The UTF-8 encoding may not exceed 128 bytes.MongoClientSettings.getApplicationName()
public MongoClientSettings.Builder dbPath(String dbPath)
dbPath
- the path for the databasepublic MongoClientSettings build()
MongoClientSettings
.