Class MongoClientSettings.Builder

  • Enclosing class:
    MongoClientSettings

    @NotThreadSafe
    public static final class MongoClientSettings.Builder
    extends Object
    A builder for MongoClientSettings so that MongoClientSettings can be immutable, and to support easier construction through chaining.
    • Method Detail

      • applyConnectionString

        public MongoClientSettings.Builder applyConnectionString​(ConnectionString connectionString)
        Takes the settings from the given ConnectionString and applies them to the builder
        Parameters:
        connectionString - the connection string containing details of how to connect to MongoDB
        Returns:
        this
      • addCommandListener

        public MongoClientSettings.Builder addCommandListener​(CommandListener commandListener)
        Adds the given command listener.
        Parameters:
        commandListener - the command listener
        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()
      • build

        public MongoClientSettings build()
        Build an instance of MongoClientSettings.
        Returns:
        the settings from this builder