Package com.mongodb

Class ServerApi.Builder

  • Enclosing class:
    ServerApi

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

      • version

        public ServerApi.Builder version​(ServerApiVersion version)
        Gets the server API version
        Parameters:
        version - the server API version
        Returns:
        the server API version
      • deprecationErrors

        public ServerApi.Builder deprecationErrors​(boolean deprecationErrors)
        Sets whether the application requires use of deprecated server APIs to be reported as errors.

        The default is false.

        Parameters:
        deprecationErrors - whether the application requires use of deprecated server APIs to be reported as errors
        Returns:
        this
      • strict

        public ServerApi.Builder strict​(boolean strict)
        Sets whether the application requires strict server API version enforcement.

        The default is false.

        Parameters:
        strict - whether the application requires strict server API version enforcement
        Returns:
        this
      • build

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