Class PathMatchingRouterBuilder

  • All Implemented Interfaces:
    PathToRouterBuilder

    final class PathMatchingRouterBuilder
    extends java.lang.Object
    implements PathToRouterBuilder
    /** A request path pattern matching router hierarchy builder entry point.
    • Field Detail

      • acceptedRoutes

        private final java.util.List<Route> acceptedRoutes
      • currentRouters

        private java.util.List<Router> currentRouters
    • Constructor Detail

      • PathMatchingRouterBuilder

        private PathMatchingRouterBuilder()
    • Method Detail

      • newRoute

        static PathToRouterBuilder newRoute​(PathPattern pattern)
        Create new request path pattern matching router builder.
        Parameters:
        pattern - request path matching pattern.
        Returns:
        new request path pattern matching router builder.
      • startNewRoute

        private void startNewRoute​(PathPattern pattern)
      • acceptedRoutes

        protected java.util.List<Route> acceptedRoutes()
        Get the list of the registered sub-routes.
        Returns:
        list of the registered sub-routes.
      • to

        public PathMatchingRouterBuilder to​(Router router)
        Description copied from interface: PathToRouterBuilder
        Register a new next-level router to be used for request routing in case the routing pattern matches the unmatched right-hand part of the request path.
        Specified by:
        to in interface PathToRouterBuilder
        Parameters:
        router - new next-level router to be registered with the routed path pattern.
        Returns:
        updated route builder ready to build a new router instance (or add more routes to the currently built one).
      • route

        public PathToRouterBuilder route​(PathPattern pattern)
        Complete the currently built unfinished sub-route (if any) and start building a new one. The completed sub-route is added to the list of the routes accepted by the router that is being built.
        Parameters:
        pattern - routing pattern for the new sub-route.
        Returns:
        updated router builder.