Created
March 21, 2020 13:50
-
-
Save imanushin/1c9855b0b410c68971db9bdff2b93c5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionalInterface | |
public interface RouterFunction<T extends ServerResponse> { | |
Mono<HandlerFunction<T>> route(ServerRequest request); | |
default RouterFunction<T> and(RouterFunction<T> other) { | |
return new RouterFunctions.SameComposedRouterFunction<>(this, other); | |
} | |
default RouterFunction<?> andOther(RouterFunction<?> other) { | |
return new RouterFunctions.DifferentComposedRouterFunction(this, other); | |
} | |
default RouterFunction<T> andRoute(RequestPredicate predicate, HandlerFunction<T> handlerFunction) { | |
return and(RouterFunctions.route(predicate, handlerFunction)); | |
} | |
default RouterFunction<T> andNest(RequestPredicate predicate, RouterFunction<T> routerFunction) { | |
return and(RouterFunctions.nest(predicate, routerFunction)); | |
} | |
default <S extends ServerResponse> RouterFunction<S> filter(HandlerFilterFunction<T, S> filterFunction) { | |
return new RouterFunctions.FilteredRouterFunction<>(this, filterFunction); | |
} | |
default void accept(RouterFunctions.Visitor visitor) { | |
visitor.unknown(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment