@NotThreadSafe public static final class MongoClientSettings.Builder extends java.lang.Object
MongoClientSettings so that MongoClientSettings can be immutable, and to support easier construction
through chaining.| Modifier and Type | Method and Description |
|---|---|
MongoClientSettings.Builder |
addCommandListener(CommandListener commandListener)
Adds the given command listener.
|
MongoClientSettings.Builder |
applicationName(java.lang.String applicationName)
Sets the logical name of the application using this MongoClient.
|
MongoClientSettings |
build()
Build an instance of
MongoClientSettings. |
MongoClientSettings.Builder |
clusterSettings(ClusterSettings clusterSettings)
Sets the cluster settings.
|
MongoClientSettings.Builder |
codecRegistry(CodecRegistry codecRegistry)
Sets the codec registry
|
MongoClientSettings.Builder |
compressorList(java.util.List<MongoCompressor> compressorList)
Sets the compressors to use for compressing messages to the server.
|
MongoClientSettings.Builder |
connectionPoolSettings(ConnectionPoolSettings connectionPoolSettings)
Sets the connection pool settings.
|
MongoClientSettings.Builder |
credential(MongoCredential credential)
Sets the credential.
|
MongoClientSettings.Builder |
credentialList(java.util.List<MongoCredential> credentialList)
Deprecated.
Prefer
credential(MongoCredential) |
MongoClientSettings.Builder |
heartbeatSocketSettings(SocketSettings heartbeatSocketSettings)
Sets the heartbeat socket settings.
|
MongoClientSettings.Builder |
readConcern(ReadConcern readConcern)
Sets the read concern.
|
MongoClientSettings.Builder |
readPreference(ReadPreference readPreference)
Sets the read preference.
|
MongoClientSettings.Builder |
retryWrites(boolean retryWrites)
Sets whether writes should be retried if they fail due to a network error.
|
MongoClientSettings.Builder |
serverSettings(ServerSettings serverSettings)
Sets the server settings.
|
MongoClientSettings.Builder |
socketSettings(SocketSettings socketSettings)
Sets the socket settings.
|
MongoClientSettings.Builder |
sslSettings(SslSettings sslSettings)
Sets the socket settings.
|
MongoClientSettings.Builder |
streamFactoryFactory(StreamFactoryFactory streamFactoryFactory)
Sets the factory to use to create a
StreamFactory. |
MongoClientSettings.Builder |
writeConcern(WriteConcern writeConcern)
Sets the write concern.
|
public MongoClientSettings.Builder clusterSettings(ClusterSettings clusterSettings)
clusterSettings - the cluster settingsthisMongoClientSettings.getClusterSettings()public MongoClientSettings.Builder socketSettings(SocketSettings socketSettings)
socketSettings - the socket settingsthisMongoClientSettings.getSocketSettings()public MongoClientSettings.Builder heartbeatSocketSettings(SocketSettings heartbeatSocketSettings)
heartbeatSocketSettings - the socket settingsthisMongoClientSettings.getHeartbeatSocketSettings()public MongoClientSettings.Builder connectionPoolSettings(ConnectionPoolSettings connectionPoolSettings)
connectionPoolSettings - the connection settingsthis()public MongoClientSettings.Builder serverSettings(ServerSettings serverSettings)
serverSettings - the server settingsthis()public MongoClientSettings.Builder sslSettings(SslSettings sslSettings)
sslSettings - the SSL settingsthis()public MongoClientSettings.Builder readPreference(ReadPreference readPreference)
readPreference - read preferencethisMongoClientSettings.getReadPreference()public MongoClientSettings.Builder writeConcern(WriteConcern writeConcern)
writeConcern - the write concernthisMongoClientSettings.getWriteConcern()public MongoClientSettings.Builder retryWrites(boolean retryWrites)
retryWrites - sets if writes should be retried if they fail due to a network error.thisMongoClientSettings.getRetryWrites()public MongoClientSettings.Builder readConcern(ReadConcern readConcern)
readConcern - the read concernthis@Deprecated public MongoClientSettings.Builder credentialList(java.util.List<MongoCredential> credentialList)
credential(MongoCredential)credentialList - the credential listthisMongoClientSettings.getCredentialList()public MongoClientSettings.Builder credential(MongoCredential credential)
credential - the credentialthisMongoClientSettings.getCredentialList()public MongoClientSettings.Builder codecRegistry(CodecRegistry codecRegistry)
codecRegistry - the codec registrythisMongoClientSettings.getCodecRegistry()public MongoClientSettings.Builder streamFactoryFactory(StreamFactoryFactory streamFactoryFactory)
StreamFactory.streamFactoryFactory - the stream factory factorypublic MongoClientSettings.Builder addCommandListener(CommandListener commandListener)
commandListener - the command listenerpublic MongoClientSettings.Builder applicationName(java.lang.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.thisMongoClientSettings.getApplicationName()public MongoClientSettings.Builder compressorList(java.util.List<MongoCompressor> compressorList)
compressorList - the list of compressors to requestthis()public MongoClientSettings build()
MongoClientSettings.