/** * Return a composed filter function that first applies this filter, and then applies the * {@code after} filter. * @param after the filter to apply after this filter is applied * @return a composed filter that first applies this function and then applies the * {@code after} function */ default HandlerFilterFunction<T, R> andThen(HandlerFilterFunction<T, T> after) { Assert.notNull(after, "HandlerFilterFunction must not be null"); return (request, next) -> { HandlerFunction<T> nextHandler = handlerRequest -> after.filter(handlerRequest, next); return filter(request, nextHandler); }; }
/** * Apply this filter to the given handler function, resulting in a filtered handler function. * @param handler the handler function to filter * @return the filtered handler function */ default HandlerFunction<R> apply(HandlerFunction<T> handler) { Assert.notNull(handler, "HandlerFunction must not be null"); return request -> this.filter(request, handler); }
/** * Apply this filter to the given handler function, resulting in a filtered handler function. * @param handler the handler function to filter * @return the filtered handler function */ default HandlerFunction<R> apply(HandlerFunction<T> handler) { Assert.notNull(handler, "'handler' must not be null"); return request -> this.filter(request, handler); }
/** * Return a composed filter function that first applies this filter, and then applies the * {@code after} filter. * @param after the filter to apply after this filter is applied * @return a composed filter that first applies this function and then applies the * {@code after} function */ default HandlerFilterFunction<T, R> andThen(HandlerFilterFunction<T, T> after) { Assert.notNull(after, "'after' must not be null"); return (request, next) -> { HandlerFunction<T> nextHandler = handlerRequest -> after.filter(handlerRequest, next); return filter(request, nextHandler); }; }