Package com.vaadin.flow.router.internal
Class ConfiguredRoutes
java.lang.Object
com.vaadin.flow.router.internal.ConfiguredRoutes
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ConfigureRoutes
Route configuration class that is used as a value object.
Note! This is always immutable and any changes should be made from
ConfigureRoutes
.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.3
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate an immutable RouteConfiguration.ConfiguredRoutes
(ConfigureRoutes original) Create a mutable or immutable configuration with original configuration information. -
Method Summary
Modifier and TypeMethodDescriptioncopyTargetRouteModels
(boolean mutable) Make a copy of the target and route models mapping.getExceptionHandlerByClass
(Class<?> exceptionClass) Get a exception handler by exception class.Get all registered exception handlers as a exception-to-handler map.Search for a route target using given navigationurl
argument.getParameters
(String template) Gets the parameters defined by the given template.Get the route class matching the given path and path segments.getRoutePaths
(Class<? extends Component> routeTarget) Collect all routes for which given routeTarget is registered.Get all registered paths that have been registered.protected Map<String,
RouteTarget> getRouteTarget
(Class<? extends Component> target, RouteParameters parameters) Gets theRouteTarget
instance matching the given target component and route parameters.protected RouteTarget
getRouteTarget
(String template) Get the RouteTarget stored for the given template.Get the target class matching the given url.getTargetRoute
(Class<? extends Component> navigationTarget) Get the route template String for the given navigation target class.Get all registered target routes for this configuration mapping the main template.getTargetUrl
(Class<? extends Component> navigationTarget) Get the url path String for the given navigation target class.getTargetUrl
(Class<? extends Component> navigationTarget, RouteParameters parameters) Get the url path String for the given navigation target class and parameters.getTemplate
(Class<? extends Component> navigationTarget) Get the route template String for the given navigation target class.getTemplate
(Class<? extends Component> navigationTarget, Set<RouteParameterFormatOption> format) Get the route template String for the given navigation target class and using the specified parameters format.boolean
See if configuration contains a registered route for given path.boolean
Check if configuration holds a route for given path with possible path segments.boolean
hasRouteTarget
(Class<? extends Component> target) Check it the given route target has been registered to the configuration.boolean
hasTemplate
(String template) See if configuration contains a registered route for given template.
-
Constructor Details
-
ConfiguredRoutes
public ConfiguredRoutes()Create an immutable RouteConfiguration. -
ConfiguredRoutes
Create a mutable or immutable configuration with original configuration information.- Parameters:
original
- original configuration to get data from
-
-
Method Details
-
getRoutesMap
-
getRoutePaths
Collect all routes for which given routeTarget is registered. This is mainly for handling route aliases as reading from the class annotations doesn't specifically return the actual registrations as they can change during runtime.- Parameters:
routeTarget
- route target to collect registered paths for- Returns:
- list of routes this routeTarget is registered for
-
hasRoute
See if configuration contains a registered route for given path.- Parameters:
path
- path to check- Returns:
- true if configuration contains route
-
hasTemplate
See if configuration contains a registered route for given template.- Parameters:
template
- template to check- Returns:
- true if configuration contains route
-
hasRoute
Check if configuration holds a route for given path with possible path segments.- Parameters:
path
- path string to checksegments
- path segments for route- Returns:
- true if a route is found, else false
-
hasRouteTarget
Check it the given route target has been registered to the configuration.- Parameters:
target
- target to check registration status for- Returns:
- true if target is found in configuration
-
getRouteTarget
Gets theRouteTarget
instance matching the given target component and route parameters.- Parameters:
target
- a component class which is a navigation target.parameters
- parameter values that may be used with given target.- Returns:
- the
RouteTarget
instance matching the given target component and route parameters.
-
getTarget
Get the target class matching the given url.- Parameters:
url
- string to get the route for- Returns:
Optional
containing the navigationTarget class if found
-
getRoute
Get the route class matching the given path and path segments.- Parameters:
url
- string to get the route forsegments
- possible path segments- Returns:
Optional
containing the navigationTarget class if found
-
getRoutes
Get all registered paths that have been registered.- Returns:
- Set containing all the registered paths
-
getTargetRoutes
Get all registered target routes for this configuration mapping the main template.- Returns:
- component-to-path map of all target routes
-
copyTargetRouteModels
protected final Map<Class<? extends Component>,com.vaadin.flow.router.internal.RouteModel> copyTargetRouteModels(boolean mutable) Make a copy of the target and route models mapping.- Returns:
- a copy of the target and route models mapping.
-
getTargetRoute
Get the route template String for the given navigation target class.- Parameters:
navigationTarget
- navigationTarget to get registered route for- Returns:
- base route string if target class found
-
getTemplate
Get the route template String for the given navigation target class.- Parameters:
navigationTarget
- navigationTarget to get registered route for- Returns:
- base route string if target class found
-
getTemplate
public String getTemplate(Class<? extends Component> navigationTarget, Set<RouteParameterFormatOption> format) Get the route template String for the given navigation target class and using the specified parameters format.- Parameters:
navigationTarget
- navigationTarget to get registered route forformat
- settings used to format the result parameters. If all ofRouteParameterFormatOption.NAME
,RouteParameterFormatOption.MODIFIER
andRouteParameterFormatOption.REGEX
are provided, the unformatted template will be provided.- Returns:
- base route string if target class found
-
getTargetUrl
Get the url path String for the given navigation target class.- Parameters:
navigationTarget
- navigationTarget to get registered route for- Returns:
- route string if target class found
-
getTargetUrl
Get the url path String for the given navigation target class and parameters.- Parameters:
navigationTarget
- navigationTarget to get registered route forparameters
- route parameters- Returns:
- url String populated with parameters for the given navigationTarget
-
getExceptionHandlerByClass
Get a exception handler by exception class.- Parameters:
exceptionClass
- exception class to get exception handler for- Returns:
- exception handler if found
-
getExceptionHandlers
Get all registered exception handlers as a exception-to-handler map.- Returns:
- all registered exception handlers
-
getParameters
Gets the parameters defined by the given template.- Parameters:
template
- template to get parameters from.- Returns:
- map parameter names with
RouteParameterData
.
-
getRouteTarget
Get the RouteTarget stored for the given template.- Parameters:
template
- template to get route target for- Returns:
- route target for template,
null
if nothing registered
-