Package com.mongodb.embedded.client
Class MongoClientSettings.Builder
- java.lang.Object
-
- com.mongodb.embedded.client.MongoClientSettings.Builder
-
- Enclosing class:
- MongoClientSettings
@NotThreadSafe public static final class MongoClientSettings.Builder extends Object
A builder forMongoClientSettingsso thatMongoClientSettingscan be immutable, and to support easier construction through chaining.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MongoClientSettings.BuilderaddCommandListener(CommandListener commandListener)Adds the given command listener.MongoClientSettings.BuilderapplicationName(String applicationName)Sets the logical name of the application using this MongoClient.MongoClientSettings.BuilderapplyConnectionString(ConnectionString connectionString)Takes the settings from the givenConnectionStringand applies them to the builderMongoClientSettingsbuild()Build an instance ofMongoClientSettings.MongoClientSettings.BuildercodecRegistry(CodecRegistry codecRegistry)Sets the codec registryMongoClientSettings.BuildercommandListenerList(List<CommandListener> commandListeners)Sets the the command listenersMongoClientSettings.BuilderdbPath(String dbPath)Sets the dbPath for the mongod.
-
-
-
Method Detail
-
applyConnectionString
public MongoClientSettings.Builder applyConnectionString(ConnectionString connectionString)
Takes the settings from the givenConnectionStringand applies them to the builder- Parameters:
connectionString- the connection string containing details of how to connect to MongoDB- Returns:
- this
-
codecRegistry
public MongoClientSettings.Builder codecRegistry(CodecRegistry codecRegistry)
Sets the codec registry- Parameters:
codecRegistry- the codec registry- Returns:
- this
- See Also:
MongoClientSettings.getCodecRegistry()
-
addCommandListener
public MongoClientSettings.Builder addCommandListener(CommandListener commandListener)
Adds the given command listener.- Parameters:
commandListener- the command listener- Returns:
- this
-
commandListenerList
public MongoClientSettings.Builder commandListenerList(List<CommandListener> commandListeners)
Sets the the command listeners- Parameters:
commandListeners- the list of command listeners- Returns:
- this
-
applicationName
public MongoClientSettings.Builder applicationName(String applicationName)
Sets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection.- Parameters:
applicationName- the logical name of the application using this MongoClient. It may be null. The UTF-8 encoding may not exceed 128 bytes.- Returns:
- this
- See Also:
MongoClientSettings.getApplicationName()
-
dbPath
public MongoClientSettings.Builder dbPath(String dbPath)
Sets the dbPath for the mongod.- Parameters:
dbPath- the path for the database- Returns:
- this
-
build
public MongoClientSettings build()
Build an instance ofMongoClientSettings.- Returns:
- the settings from this builder
-
-