@Immutable public final class MongoClientSettings extends java.lang.Object
MongoClient
.Modifier and Type | Class and Description |
---|---|
static class |
MongoClientSettings.Builder
A builder for
MongoClientSettings so that MongoClientSettings can be immutable, and to support easier construction
through chaining. |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
applicationName |
private ClusterSettings |
clusterSettings |
private CodecRegistry |
codecRegistry |
private java.util.List<CommandListener> |
commandListeners |
private ConnectionPoolSettings |
connectionPoolSettings |
private java.util.List<MongoCredential> |
credentialList |
private SocketSettings |
heartbeatSocketSettings |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
private ServerSettings |
serverSettings |
private SocketSettings |
socketSettings |
private SslSettings |
sslSettings |
private StreamFactoryFactory |
streamFactoryFactory |
private WriteConcern |
writeConcern |
Modifier | Constructor and Description |
---|---|
private |
MongoClientSettings(MongoClientSettings.Builder builder) |
Modifier and Type | Method and Description |
---|---|
static MongoClientSettings.Builder |
builder()
Convenience method to create a Builder.
|
static MongoClientSettings.Builder |
builder(MongoClientSettings settings)
Convenience method to create a from an existing
MongoClientSettings . |
java.lang.String |
getApplicationName()
Gets the logical name of the application using this MongoClient.
|
ClusterSettings |
getClusterSettings()
Gets the cluster settings.
|
CodecRegistry |
getCodecRegistry()
The codec registry to use.
|
java.util.List<CommandListener> |
getCommandListeners()
Gets the list of added
CommandListener . |
ConnectionPoolSettings |
getConnectionPoolSettings()
Gets the settings for the connection provider in a settings object.
|
java.util.List<MongoCredential> |
getCredentialList()
Gets the credential list.
|
SocketSettings |
getHeartbeatSocketSettings()
Gets the connection settings for the heartbeat thread (the background task that checks the state of the cluster) wrapped in a
settings object.
|
ReadConcern |
getReadConcern()
The read concern to use.
|
ReadPreference |
getReadPreference()
The read preference to use for queries, map-reduce, aggregation, and count.
|
ServerSettings |
getServerSettings()
Gets the server-specific settings wrapped in a settings object.
|
SocketSettings |
getSocketSettings()
Gets the connection-specific settings wrapped in a settings object.
|
SslSettings |
getSslSettings()
Gets the SSL settings.
|
StreamFactoryFactory |
getStreamFactoryFactory()
Gets the factory to use to create a
StreamFactory . |
WriteConcern |
getWriteConcern()
The write concern to use.
|
private final ReadPreference readPreference
private final WriteConcern writeConcern
private final ReadConcern readConcern
private final java.util.List<MongoCredential> credentialList
private final StreamFactoryFactory streamFactoryFactory
private final java.util.List<CommandListener> commandListeners
private final CodecRegistry codecRegistry
private final ClusterSettings clusterSettings
private final SocketSettings socketSettings
private final SocketSettings heartbeatSocketSettings
private final ConnectionPoolSettings connectionPoolSettings
private final ServerSettings serverSettings
private final SslSettings sslSettings
private final java.lang.String applicationName
private MongoClientSettings(MongoClientSettings.Builder builder)
public static MongoClientSettings.Builder builder()
public static MongoClientSettings.Builder builder(MongoClientSettings settings)
MongoClientSettings
.settings
- create a builder from existing settingspublic ReadPreference getReadPreference()
Default is ReadPreference.primary()
.
ReadPreference.primary()
public java.util.List<MongoCredential> getCredentialList()
public WriteConcern getWriteConcern()
Default is WriteConcern.ACKNOWLEDGED
.
WriteConcern.ACKNOWLEDGED
public ReadConcern getReadConcern()
public CodecRegistry getCodecRegistry()
MongoClient
will be able to encode and decode instances of Document
.MongoClient.getDatabase(java.lang.String)
public StreamFactoryFactory getStreamFactoryFactory()
StreamFactory
.public java.util.List<CommandListener> getCommandListeners()
CommandListener
. The default is an empty list.public java.lang.String getApplicationName()
Default is null.
public ClusterSettings getClusterSettings()
public SslSettings getSslSettings()
public SocketSettings getSocketSettings()
MongoClientSettings
instance.SocketSettings
public SocketSettings getHeartbeatSocketSettings()
MongoClientSettings
instance.SocketSettings
public ConnectionPoolSettings getConnectionPoolSettings()
MongoClientSettings
instance that relate to the
connection provider.ConnectionPoolSettings
public ServerSettings getServerSettings()
MongoClientSettings
instance.ServerSettings