public class ConfiguredRoutes extends Object implements Serializable
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.
Constructor and Description |
---|
ConfiguredRoutes()
Create an immutable RouteConfiguration.
|
ConfiguredRoutes(ConfigureRoutes original)
Create a mutable or immutable configuration with original configuration
information.
|
Modifier and Type | Method and Description |
---|---|
protected Map<Class<? extends Component>,com.vaadin.flow.router.internal.RouteModel> |
copyTargetRouteModels(boolean mutable)
Make a copy of the target and route models mapping.
|
Class<? extends Component> |
getExceptionHandlerByClass(Class<?> exceptionClass)
Get a exception handler by exception class.
|
Map<Class<? extends Exception>,Class<? extends Component>> |
getExceptionHandlers()
Get all registered exception handlers as a exception-to-handler map.
|
NavigationRouteTarget |
getNavigationRouteTarget(String url)
Search for a route target using given navigation
url
argument. |
Map<String,RouteParameterData> |
getParameters(String template)
Gets the parameters defined by the given template.
|
List<Class<? extends RouterLayout>> |
getParentLayouts(String path,
Class<? extends Component> navigationTarget)
Deprecated.
use
getNavigationRouteTarget(String) instead. |
Optional<Class<? extends Component>> |
getRoute(String url,
List<String> segments)
Get the route class matching the given path and path segments.
|
protected List<String> |
getRoutePaths(Class<? extends Component> routeTarget)
Collect all routes for which given routeTarget is registered.
|
Set<String> |
getRoutes()
Get all registered paths that have been registered.
|
protected Map<String,RouteTarget> |
getRoutesMap() |
RouteTarget |
getRouteTarget(Class<? extends Component> target,
RouteParameters parameters)
Gets the
RouteTarget instance matching the given target component
and route parameters. |
protected RouteTarget |
getRouteTarget(String template)
Get the RouteTarget stored for the given template.
|
Optional<Class<? extends Component>> |
getTarget(String url)
Get the target class matching the given url.
|
String |
getTargetRoute(Class<? extends Component> navigationTarget)
Get the route template String for the given navigation target class.
|
Map<Class<? extends Component>,String> |
getTargetRoutes()
Get all registered target routes for this configuration mapping the main
template.
|
String |
getTargetUrl(Class<? extends Component> navigationTarget)
Get the url path String for the given navigation target class.
|
String |
getTargetUrl(Class<? extends Component> navigationTarget,
RouteParameters parameters)
Get the url path String for the given navigation target class and
parameters.
|
String |
getTemplate(Class<? extends Component> navigationTarget)
Get the route template String for the given navigation target class.
|
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.
|
boolean |
hasRoute(String path)
See if configuration contains a registered route for given path.
|
boolean |
hasRoute(String path,
List<String> segments)
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.
|
public ConfiguredRoutes()
public ConfiguredRoutes(ConfigureRoutes original)
original
- original configuration to get data fromprotected Map<String,RouteTarget> getRoutesMap()
protected List<String> getRoutePaths(Class<? extends Component> routeTarget)
routeTarget
- route target to collect registered paths forpublic boolean hasRoute(String path)
path
- path to checkpublic boolean hasTemplate(String template)
template
- template to checkpublic boolean hasRoute(String path, List<String> segments)
path
- path string to checksegments
- path segments for routepublic boolean hasRouteTarget(Class<? extends Component> target)
target
- target to check registration status forpublic NavigationRouteTarget getNavigationRouteTarget(String url)
url
argument.url
- the navigation url used to search a route target.NavigationRouteTarget
instance containing the
RouteTarget
and RouteParameters
extracted from
the url
argument according with the route
configuration.public RouteTarget getRouteTarget(Class<? extends Component> target, RouteParameters parameters)
RouteTarget
instance matching the given target component
and route parameters.target
- a component class which is a navigation target.parameters
- parameter values that may be used with given target.RouteTarget
instance matching the given target
component and route parameters.public Optional<Class<? extends Component>> getTarget(String url)
url
- string to get the route forOptional
containing the navigationTarget class if foundpublic Optional<Class<? extends Component>> getRoute(String url, List<String> segments)
url
- string to get the route forsegments
- possible path segmentsOptional
containing the navigationTarget class if foundpublic Set<String> getRoutes()
public Map<Class<? extends Component>,String> getTargetRoutes()
protected final Map<Class<? extends Component>,com.vaadin.flow.router.internal.RouteModel> copyTargetRouteModels(boolean mutable)
public String getTargetRoute(Class<? extends Component> navigationTarget)
navigationTarget
- navigationTarget to get registered route forpublic String getTemplate(Class<? extends Component> navigationTarget)
navigationTarget
- navigationTarget to get registered route forpublic String getTemplate(Class<? extends Component> navigationTarget, Set<RouteParameterFormatOption> format)
navigationTarget
- navigationTarget to get registered route forformat
- settings used to format the result parameters. If all of
RouteParameterFormatOption.NAME
,
RouteParameterFormatOption.MODIFIER
and
RouteParameterFormatOption.REGEX
are provided, the
unformatted template will be provided.public String getTargetUrl(Class<? extends Component> navigationTarget)
navigationTarget
- navigationTarget to get registered route forpublic String getTargetUrl(Class<? extends Component> navigationTarget, RouteParameters parameters)
navigationTarget
- navigationTarget to get registered route forparameters
- route parameterspublic Class<? extends Component> getExceptionHandlerByClass(Class<?> exceptionClass)
exceptionClass
- exception class to get exception handler forpublic Map<Class<? extends Exception>,Class<? extends Component>> getExceptionHandlers()
@Deprecated public List<Class<? extends RouterLayout>> getParentLayouts(String path, Class<? extends Component> navigationTarget)
getNavigationRouteTarget(String)
instead.path
- path to get parent layout chain for.navigationTarget
- navigation target on path to get parent layout chain for.public Map<String,RouteParameterData> getParameters(String template)
template
- template to get parameters from.RouteParameterData
.protected RouteTarget getRouteTarget(String template)
template
- template to get route target fornull
if nothing
registeredCopyright © 2022. All rights reserved.