Class DefaultRouter
java.lang.Object
dev.voidframework.web.routing.impl.DefaultRouter
- All Implemented Interfaces:
Router,RouterPostInitialization
Default implementation of
Router.-
Constructor Summary
Constructors -
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.voidThis method will be called after all routes has been discovered and registered.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.
-
Constructor Details
-
DefaultRouter
public DefaultRouter()Build a new instance.
-
-
Method Details
-
addRoute
public void addRoute(HttpMethod httpMethod, String routeUrl, Class<?> controllerClassType, Method method) Description copied from interface:RouterAdds a new route. -
addRoute
public void addRoute(HttpMethod httpMethod, String routeUrl, Class<?> controllerClassType, Method method, String name) Description copied from interface:RouterAdds a new route. -
resolveRoute
Description copied from interface:RouterResolves a route.- Specified by:
resolveRoutein interfaceRouter- Parameters:
httpMethod- The HTTP method (ie: GET)uri- The URI to parse to resolve route- Returns:
- The resolved route, otherwise,
null
-
reverseRoute
Description copied from interface:RouterReverses a route to obtains a URL.- Specified by:
reverseRoutein interfaceRouter- Parameters:
name- The route name- Returns:
- A string containing a URL
-
reverseRoute
Description copied from interface:RouterReverses a route to obtains a URL.- Specified by:
reverseRoutein interfaceRouter- Parameters:
name- The route nameparameterList- The parameters to use- Returns:
- A string containing a URL
-
getRoutesAsList
Description copied from interface:RouterRetrieves all registered routes.- Specified by:
getRoutesAsListin interfaceRouter- Returns:
- All registered routes as List
-
getRoutesAsMap
Description copied from interface:RouterRetrieves all registered routes.- Specified by:
getRoutesAsMapin interfaceRouter- Returns:
- All registered routes as Map
-
onPostInitialization
public void onPostInitialization()Description copied from interface:RouterPostInitializationThis method will be called after all routes has been discovered and registered.- Specified by:
onPostInitializationin interfaceRouterPostInitialization
-