Interface Router
- All Known Implementing Classes:
DefaultRouter
public interface Router
Router.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddRoute(HttpMethod httpMethod, RouteURL routeURL, Class<?> controllerClassType, Method method) Adds a new route.voidaddRoute(HttpMethod httpMethod, RouteURL 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
void addRoute(HttpMethod httpMethod, RouteURL routeURL, Class<?> controllerClassType, Method method) Adds a new route.- Parameters:
httpMethod- The HTTP method (ie: GET)routeURL- The route URLcontrollerClassType- The controller class typemethod- The method to- Since:
- 1.0.0
-
addRoute
void addRoute(HttpMethod httpMethod, RouteURL 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- Since:
- 1.0.0
-
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 - Since:
- 1.0.0
-
reverseRoute
Reverses a route to obtains a URL.- Parameters:
name- The route name- Returns:
- A string containing a URL
- Since:
- 1.0.0
-
reverseRoute
Reverses a route to obtains a URL.- Parameters:
name- The route nameparameterList- The parameters to use- Returns:
- A string containing a URL
- Since:
- 1.0.0
-
getRoutesAsList
Retrieves all registered routes.- Returns:
- All registered routes as List
- Since:
- 1.0.0
-
getRoutesAsMap
Map<HttpMethod,List<Route>> getRoutesAsMap()Retrieves all registered routes.- Returns:
- All registered routes as Map
- Since:
- 1.0.0
-