Class WebEndpointMapping.Builder<E>

  • Enclosing class:
    WebEndpointMapping<E>

    public static class WebEndpointMapping.Builder<E>
    extends java.lang.Object
    • Method Detail

      • endpoint

        public WebEndpointMapping.Builder<E> endpoint​(@Nonnull
                                                      E endpoint)
        Set the endpoint for the WebEndpointMapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.endpoint("myServlet");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.endpoint(handlerMethod);
         
        Parameters:
        endpoint - the endpoint (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the endpoint is null
      • pattern

        @Nonnull
        public WebEndpointMapping.Builder<E> pattern​(@Nonnull
                                                     java.lang.String pattern)
                                              throws java.lang.IllegalArgumentException
        Add a single path pattern to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.pattern("/api/users");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.pattern("/api/products/{id}");
         
        Parameters:
        pattern - the path pattern to add (must not be null or blank)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the pattern is null or blank
      • patterns

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> patterns​(java.util.Collection<V> values,
                                                          java.util.function.Function<V,​java.lang.String> stringFunction)
        Set multiple path patterns to the endpoint mapping from a collection of values.

        Example Usage

        
         // For a servlet endpoint with a list of pattern strings
         List<String> patternList = Arrays.asList("/api/users", "/api/orders");
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.patterns(patternList, Function.identity());
        
         // For a WebFlux endpoint with custom objects that have a getName() method
         List<MyPathPattern> patterns = getCustomPatternObjects();
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.patterns(patterns, MyPathPattern::getName);
         
        Type Parameters:
        V - the type of values in the collection
        Parameters:
        values - the collection of values to convert to patterns (must not be null)
        stringFunction - the function to convert each value to a string pattern (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the values or stringFunction is null
      • patterns

        @Nonnull
        public WebEndpointMapping.Builder<E> patterns​(@Nonnull
                                                      java.lang.String... patterns)
                                               throws java.lang.IllegalArgumentException
        Set multiple path patterns to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.patterns("/api/users", "/api/orders");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.patterns("/api/products/{id}", "/api/categories/{categoryId}");
         
        Parameters:
        patterns - the path patterns to add (must not be null or empty)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the patterns array is null, empty, or contains null elements
      • patterns

        @Nonnull
        public WebEndpointMapping.Builder<E> patterns​(@Nonnull
                                                      java.util.Collection<java.lang.String> patterns)
        Set multiple path patterns to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.patterns(Arrays.asList("/api/users", "/api/orders"));
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.patterns(Arrays.asList("/api/products/{id}", "/api/categories/{categoryId}"));
         
        Parameters:
        patterns - the collection of path patterns to add (must not be null or empty)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the patterns collection is null, empty, or contains null elements
      • method

        @Nonnull
        public WebEndpointMapping.Builder<E> method​(@Nonnull
                                                    org.springframework.http.HttpMethod method)
                                             throws java.lang.IllegalArgumentException
        Add a single HTTP method to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.method(HttpMethod.GET);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.method(HttpMethod.POST);
         
        Parameters:
        method - the HTTP method to add (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the method is null
      • method

        @Nonnull
        public WebEndpointMapping.Builder<E> method​(@Nonnull
                                                    java.lang.String method)
                                             throws java.lang.IllegalArgumentException
        Add a single HTTP method to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.method("GET");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.method("POST");
         
        Parameters:
        method - the HTTP method to add (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the method is null
      • methods

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> methods​(java.util.Collection<V> values,
                                                         java.util.function.Function<V,​java.lang.String> stringFunction)
        Set multiple HTTP methods to the endpoint mapping from a collection of values.

        Example Usage

        
         // For a servlet endpoint with a list of HttpMethod enums
         List<HttpMethod> methodList = Arrays.asList(HttpMethod.GET, HttpMethod.POST);
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.methods(methodList, HttpMethod::name);
        
         // For a WebFlux endpoint with custom objects that have a getMethodName() method
         List<MyHttpMethod> methods = getCustomMethodObjects();
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.methods(methods, MyHttpMethod::getMethodName);
         
        Type Parameters:
        V - the type of values in the collection
        Parameters:
        values - the collection of values to convert to HTTP methods (must not be null)
        stringFunction - the function to convert each value to an HTTP method string (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the values or stringFunction is null
      • methods

        @Nonnull
        public WebEndpointMapping.Builder<E> methods​(@Nonnull
                                                     org.springframework.http.HttpMethod... methods)
                                              throws java.lang.IllegalArgumentException
        Set multiple HTTP methods to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.methods(HttpMethod.GET, HttpMethod.POST);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.methods(HttpMethod.PUT, HttpMethod.DELETE);
         
        Parameters:
        methods - the HTTP methods to add (must not be null or empty)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the methods array is null, empty, or contains null elements
      • methods

        @Nonnull
        public WebEndpointMapping.Builder<E> methods​(@Nonnull
                                                     java.lang.String... methods)
                                              throws java.lang.IllegalArgumentException
        Set multiple HTTP methods to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.methods("GET", "POST");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.methods("PUT", "DELETE");
         
        Parameters:
        methods - the HTTP methods to add (must not be null or empty)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the methods array is null, empty, or contains null elements
      • methods

        public WebEndpointMapping.Builder<E> methods​(@Nonnull
                                                     java.util.Collection<java.lang.String> methods)
                                              throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • param

        @Nonnull
        public WebEndpointMapping.Builder<E> param​(@Nonnull
                                                   java.lang.String name,
                                                   @Nullable
                                                   java.lang.String value)
                                            throws java.lang.IllegalArgumentException
        Add a single request parameter to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.param("version", "v1");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.param("userId", 12345);
         
        Parameters:
        name - the parameter name (must not be blank)
        value - the parameter value (can be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the name is blank
      • param

        @Nonnull
        public WebEndpointMapping.Builder<E> param​(@Nonnull
                                                   java.lang.String nameAndValue)
                                            throws java.lang.IllegalArgumentException
        Add a single request parameter to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.param("version=v1");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.param("userId=12345");
         
        Parameters:
        nameAndValue - the parameter name and value in the format "name=value" (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the nameAndValue is null
      • params

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> params​(java.util.Collection<V> values,
                                                        java.util.function.Function<V,​java.lang.String> stringFunction)
        Set multiple request parameters to the endpoint mapping from a collection of values.

        Example Usage

        
         // For a servlet endpoint with a list of parameter objects
         List<MyParam> paramList = Arrays.asList(new MyParam("version", "v1"), new MyParam("lang", "en"));
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.params(paramList, p -> p.getName() + "=" + p.getValue());
        
         // For a WebFlux endpoint with custom objects that have a toString() method
         List<MyQueryParam> queryParams = getCustomParamObjects();
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.params(queryParams, MyQueryParam::toString);
         
        Type Parameters:
        V - the type of values in the collection
        Parameters:
        values - the collection of values to convert to parameters (must not be null)
        stringFunction - the function to convert each value to a parameter string (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the values or stringFunction is null
      • params

        @Nonnull
        public WebEndpointMapping.Builder<E> params​(@Nullable
                                                    java.lang.String... params)
        Set multiple request parameters to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.params("version=v1", "lang=en");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.params("userId=12345", "active=true");
         
        Parameters:
        params - the request parameters to add (can be null or empty)
        Returns:
        this builder instance for method chaining
      • header

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> header​(@Nonnull
                                                        java.lang.String name,
                                                        @Nullable
                                                        java.lang.String value)
        Add a single request header to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.header("X-API-Version", "v1");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.header("Authorization", "Bearer token");
         
        Parameters:
        name - the header name (must not be blank)
        value - the header value (can be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the name is blank
      • header

        @Nonnull
        public WebEndpointMapping.Builder<E> header​(@Nonnull
                                                    java.lang.String nameAndValue)
                                             throws java.lang.IllegalArgumentException
        Add a single request header to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.header("X-API-Version:v1");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.header("Authorization:Bearer token");
         
        Parameters:
        nameAndValue - the header name and value in the format "name:value" (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the nameAndValue is null
      • headers

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> headers​(java.util.Collection<V> values,
                                                         java.util.function.Function<V,​java.lang.String> stringFunction)
        Set multiple request headers to the endpoint mapping from a collection of values.

        Example Usage

        
         // For a servlet endpoint with a list of header objects
         List<MyHeader> headerList = Arrays.asList(new MyHeader("X-API-Version", "v1"), new MyHeader("Accept-Language", "en"));
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.headers(headerList, h -> h.getName() + ":" + h.getValue());
        
         // For a WebFlux endpoint with custom objects that have a toString() method
         List<MyRequestHeader> requestHeaders = getCustomHeaderObjects();
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.headers(requestHeaders, MyRequestHeader::toString);
         
        Type Parameters:
        V - the type of values in the collection
        Parameters:
        values - the collection of values to convert to headers (must not be null)
        stringFunction - the function to convert each value to a header string (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the values or stringFunction is null
      • headers

        @Nonnull
        public WebEndpointMapping.Builder<E> headers​(java.lang.String... headers)
        Set multiple request headers to the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.headers("X-API-Version:v1", "Accept-Language:en");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.headers("Authorization:Bearer token", "X-Request-ID:12345");
         
        Parameters:
        headers - the request headers to add (can be null or empty)
        Returns:
        this builder instance for method chaining
      • consume

        @Nonnull
        public WebEndpointMapping.Builder<E> consume​(org.springframework.http.MediaType mediaType)
        Add a single media type to the endpoint mapping that it can consume.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.consume(MediaType.APPLICATION_JSON);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.consume(MediaType.TEXT_PLAIN);
         
        Parameters:
        mediaType - the media type to consume (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the mediaType is null
      • consume

        @Nonnull
        public WebEndpointMapping.Builder<E> consume​(java.lang.String consume)
        Add a single media type to the endpoint mapping that it can consume.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.consume("application/json");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.consume("text/plain");
         
        Parameters:
        consume - the media type to consume (must not be blank)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the consume is blank
      • consumes

        @Nonnull
        public WebEndpointMapping.Builder<E> consumes​(org.springframework.http.MediaType... mediaTypes)
        Set multiple media types to the endpoint mapping that it can consume.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.consumes(MediaType.APPLICATION_JSON, MediaType.TEXT_XML);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.consumes(MediaType.TEXT_PLAIN, MediaType.APPLICATION_OCTET_STREAM);
         
        Parameters:
        mediaTypes - the media types to consume (must not be null or contain null elements)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the mediaTypes array is null or contains null elements
      • consumes

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> consumes​(java.util.Collection<V> values,
                                                          java.util.function.Function<V,​java.lang.String> stringFunction)
        Set multiple media types to the endpoint mapping that it can consume from a collection of values.

        Example Usage

        
         // For a servlet endpoint with a list of MediaType objects
         List<MediaType> mediaTypeList = Arrays.asList(MediaType.APPLICATION_JSON, MediaType.TEXT_XML);
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.consumes(mediaTypeList, MediaType::toString);
        
         // For a WebFlux endpoint with custom objects that have a getMimeType() method
         List<MyMediaType> customMediaTypes = getCustomMediaTypes();
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.consumes(customMediaTypes, MyMediaType::getMimeType);
         
        Type Parameters:
        V - the type of values in the collection
        Parameters:
        values - the collection of values to convert to media types (must not be null)
        stringFunction - the function to convert each value to a media type string (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the values or stringFunction is null
      • consumes

        @Nonnull
        public WebEndpointMapping.Builder<E> consumes​(java.lang.String... consumes)
        Set multiple media types to the endpoint mapping that it can consume.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.consumes("application/json", "text/xml");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.consumes("text/plain", "application/octet-stream");
         
        Parameters:
        consumes - the media types to consume (can be null or empty)
        Returns:
        this builder instance for method chaining
      • produce

        @Nonnull
        public WebEndpointMapping.Builder<E> produce​(org.springframework.http.MediaType mediaType)
        Add a single media type to the endpoint mapping that it can produce.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.produce(MediaType.APPLICATION_JSON);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.produce(MediaType.TEXT_PLAIN);
         
        Parameters:
        mediaType - the media type to produce (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the mediaType is null
      • produce

        @Nonnull
        public WebEndpointMapping.Builder<E> produce​(java.lang.String produce)
        Add a single media type to the endpoint mapping that it can produce.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.produce("application/json");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.produce("text/plain");
         
        Parameters:
        produce - the media type to produce (must not be blank)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the produce is blank
      • produces

        @Nonnull
        public WebEndpointMapping.Builder<E> produces​(org.springframework.http.MediaType... mediaTypes)
        Set multiple media types to the endpoint mapping that it can produce.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.produces(MediaType.APPLICATION_JSON, MediaType.TEXT_XML);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.produces(MediaType.TEXT_PLAIN, MediaType.APPLICATION_OCTET_STREAM);
         
        Parameters:
        mediaTypes - the media types to produce (must not be null or contain null elements)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the mediaTypes array is null or contains null elements
      • produces

        @Nonnull
        public <V> WebEndpointMapping.Builder<E> produces​(java.util.Collection<V> values,
                                                          java.util.function.Function<V,​java.lang.String> stringFunction)
        Set multiple media types to the endpoint mapping that it can produce from a collection of values.

        Example Usage

        
         // For a servlet endpoint with a list of MediaType objects
         List<MediaType> mediaTypeList = Arrays.asList(MediaType.APPLICATION_JSON, MediaType.TEXT_XML);
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.produces(mediaTypeList, MediaType::toString);
        
         // For a WebFlux endpoint with custom objects that have a getMimeType() method
         List<MyMediaType> customMediaTypes = getCustomMediaTypes();
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.produces(customMediaTypes, MyMediaType::getMimeType);
         
        Type Parameters:
        V - the type of values in the collection
        Parameters:
        values - the collection of values to convert to media types (must not be null)
        stringFunction - the function to convert each value to a media type string (must not be null)
        Returns:
        this builder instance for method chaining
        Throws:
        java.lang.IllegalArgumentException - if the values or stringFunction is null
      • produces

        @Nonnull
        public WebEndpointMapping.Builder<E> produces​(java.lang.String... produces)
        Set multiple media types to the endpoint mapping that it can produce.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.produces("application/json", "text/xml");
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.produces("text/plain", "application/octet-stream");
         
        Parameters:
        produces - the media types to produce (can be null or empty)
        Returns:
        this builder instance for method chaining
      • source

        @Nonnull
        public WebEndpointMapping.Builder<E> source​(java.lang.Object source)
        Set the source of the endpoint mapping.

        Example Usage

        
         // For a servlet endpoint
         WebEndpointMapping.Builder<String> builder = WebEndpointMapping.servlet("myServlet");
         builder.source(servletContext);
        
         // For a WebFlux endpoint
         WebEndpointMapping.Builder<HandlerMethod> webFluxBuilder = WebEndpointMapping.webflux(handlerMethod);
         webFluxBuilder.source(handlerMapping);
         
        Parameters:
        source - the source object (can be null)
        Returns:
        this builder instance for method chaining
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • pair

        protected static java.lang.String pair​(java.lang.String name,
                                               @Nullable
                                               java.lang.Object value)
      • newSet

        protected static java.util.Set<java.lang.String> newSet()
      • toStrings

        protected static java.lang.String[] toStrings​(java.util.Collection<java.lang.String> values)
      • toStrings

        protected static <V> java.lang.String[] toStrings​(java.util.Collection<V> values,
                                                          java.util.function.Function<V,​java.lang.String> stringFunction)
      • build

        @Nonnull
        public WebEndpointMapping build()
                                 throws java.lang.IllegalArgumentException
        Returns:
        non-null
        Throws:
        java.lang.IllegalArgumentException - if "endpoint" or "patterns" or "methods" is empty or has any null element