Interface Router
- All Known Implementing Classes:
DefaultRouter
public interface Router
Router.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddRoute(HttpMethod httpMethod, String routeUrl, Class<?> controllerClassType, Method method) Adds a new route.voidaddRoute(HttpMethod httpMethod, String routeUrl, Class<?> controllerClassType, Method method, String name) Adds a new route.Retrieves all registered routes.Retrieves all registered routes.resolveRoute(HttpMethod httpMethod, String uri) Resolves a route.reverseRoute(String name) Reverses a route to obtains a URL.reverseRoute(String name, List<Object> parameterList) Reverses a route to obtains a URL.
-
Method Details
-
addRoute
Adds a new route.- Parameters:
httpMethod- The HTTP method (ie: GET)routeUrl- The route urlcontrollerClassType- The controller class typemethod- The method to call
-
addRoute
void addRoute(HttpMethod httpMethod, String routeUrl, Class<?> controllerClassType, Method method, String name) Adds a new route.- Parameters:
httpMethod- The HTTP method (ie: GET)routeUrl- The route urlcontrollerClassType- The controller class typemethod- The method to callname- The route name
-
resolveRoute
Resolves a route.- Parameters:
httpMethod- The HTTP method (ie: GET)uri- The URI to parse to resolve route- Returns:
- The resolved route, otherwise,
null
-
reverseRoute
Reverses a route to obtains a URL.- Parameters:
name- The route name- Returns:
- A string containing a URL
-
reverseRoute
Reverses a route to obtains a URL.- Parameters:
name- The route nameparameterList- The parameters to use- Returns:
- A string containing a URL
-
getRoutesAsList
Retrieves all registered routes.- Returns:
- All registered routes as List
-
getRoutesAsMap
Map<HttpMethod,List<Route>> getRoutesAsMap()Retrieves all registered routes.- Returns:
- All registered routes as Map
-