@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 and 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 |
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(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(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 settingsthis
MongoClientSettings.getClusterSettings()
public MongoClientSettings.Builder socketSettings(SocketSettings socketSettings)
socketSettings
- the socket settingsthis
MongoClientSettings.getSocketSettings()
public MongoClientSettings.Builder heartbeatSocketSettings(SocketSettings heartbeatSocketSettings)
heartbeatSocketSettings
- the socket settingsthis
MongoClientSettings.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 preferencethis
MongoClientSettings.getReadPreference()
public MongoClientSettings.Builder writeConcern(WriteConcern writeConcern)
writeConcern
- the write concernthis
MongoClientSettings.getWriteConcern()
public MongoClientSettings.Builder retryWrites(boolean retryWrites)
retryWrites
- sets if writes should be retried if they fail due to a network error.this
MongoClientSettings.getRetryWrites()
public MongoClientSettings.Builder readConcern(ReadConcern readConcern)
readConcern
- the read concernthis
@Deprecated public MongoClientSettings.Builder credentialList(List<MongoCredential> credentialList)
credential(MongoCredential)
credentialList
- the credential listthis
MongoClientSettings.getCredentialList()
public MongoClientSettings.Builder credential(MongoCredential credential)
credential
- the credentialthis
MongoClientSettings.getCredentialList()
public MongoClientSettings.Builder codecRegistry(CodecRegistry codecRegistry)
codecRegistry
- the codec registrythis
MongoClientSettings.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(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.this
MongoClientSettings.getApplicationName()
public MongoClientSettings.Builder compressorList(List<MongoCompressor> compressorList)
compressorList
- the list of compressors to requestthis
()
public MongoClientSettings build()
MongoClientSettings
.Copyright © 2018. All rights reserved.