public interface RouteRegistry extends Serializable
This is used by Router when resolving navigation and layout chain
population.
| Modifier and Type | Method and Description |
|---|---|
Registration |
addRoutesChangeListener(RoutesChangedListener listener)
Adds the given route change listener to the registry.
|
void |
clean()
Clear all registered routes from the registry.
|
NavigationRouteTarget |
getNavigationRouteTarget(String url)
Search for a route target using given navigation
url
argument. |
Optional<Class<? extends Component>> |
getNavigationTarget(String url)
Gets the optional navigation target class for a given path.
|
Optional<Class<? extends Component>> |
getNavigationTarget(String url,
List<String> segments)
Gets the optional navigation target class for a given Location matching
with path segments.
|
List<RouteData> |
getRegisteredRoutes()
Get the
RouteData for all registered navigation targets. |
List<Class<? extends RouterLayout>> |
getRouteLayouts(String path,
Class<? extends Component> navigationTarget)
Deprecated.
instead use
getNavigationRouteTarget(String) and
retrieve the list of route layouts from the
RouteTarget contained in the
NavigationRouteTarget. |
RouteTarget |
getRouteTarget(Class<? extends Component> target,
RouteParameters parameters)
Gets the
RouteTarget instance matching the given target component
and route parameters. |
Optional<String> |
getTargetUrl(Class<? extends Component> navigationTarget)
Get the url string for given navigation target.
|
Optional<String> |
getTargetUrl(Class<? extends Component> navigationTarget,
RouteParameters parameters)
Get the url string for given navigation target.
|
Optional<String> |
getTemplate(Class<? extends Component> navigationTarget)
Get the main template for given navigation target.
|
void |
removeRoute(Class<? extends Component> navigationTarget)
Remove the given navigation target route registration.
|
void |
removeRoute(String path)
Remove the registration for given path.
|
void |
removeRoute(String path,
Class<? extends Component> navigationTarget)
Remove navigationTarget for the path.
|
void |
setRoute(String path,
Class<? extends Component> navigationTarget,
List<Class<? extends RouterLayout>> parentChain)
Register a navigation target with specified path and given parent layout
chain.
|
void |
update(Command command)
Block updates to the registry configuration from other threads until
update command has completed.
|
void setRoute(String path, Class<? extends Component> navigationTarget, List<Class<? extends RouterLayout>> parentChain)
ParentLayout, Route or RouteAlias will
be ignored in route handling.path - path to register navigation target tonavigationTarget - navigation target to register into session scopeparentChain - chain of parent layouts that should be used with this targetInvalidRouteConfigurationException - thrown if exact route already defined in this scopevoid removeRoute(Class<? extends Component> navigationTarget)
Note! this will remove target route and if possible any
RouteAlias route that can be found for the class.
navigationTarget - navigation target class to removevoid removeRoute(String path)
In case navigationTarget is a
HasUrlParameter, path argument needs to
include the parameter placeholder which is added automatically.
Otherwise, using removeRoute(String, Class) is preferred in such
a case.
path - path for which to remove the navigation target.void removeRoute(String path, Class<? extends Component> navigationTarget)
This method will check if indeed navigationTarget is registered with path.
In case navigationTarget is a
HasUrlParameter, the path needs to be
specified exactly as it is in the Route annotation or as it was
registered using setRoute(String, Class, List), without the
parameter placeholder which is automatically added.
path - path to remove from registrynavigationTarget - path navigation target to removeList<RouteData> getRegisteredRoutes()
RouteData for all registered navigation targets.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.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.Optional<Class<? extends Component>> getNavigationTarget(String url)
url - the path to get the navigation target for, not nullOptional<Class<? extends Component>> getNavigationTarget(String url, List<String> segments)
url - path to get navigation target for, not nullsegments - segments given for pathLocationOptional<String> getTargetUrl(Class<? extends Component> navigationTarget)
navigationTarget - navigation target to get registered route for, not
nullOptional navigation target url string or
Optional.empty() if navigation target was not foundOptional<String> getTargetUrl(Class<? extends Component> navigationTarget, RouteParameters parameters)
navigationTarget - navigation target to get registered route for, not
nullparameters - parameters for the target url.Optional navigation target url string or
Optional.empty() if navigation target was not foundOptional<String> getTemplate(Class<? extends Component> navigationTarget)
In case of annotated target the main template is composed of the
Route annotation value prefixed by all RoutePrefix values
of the parent RouterLayouts chain.
navigationTarget - navigation target to get route definition for, not
nullOptional navigation target template string or
Optional.empty() if navigation target was not found@Deprecated List<Class<? extends RouterLayout>> getRouteLayouts(String path, Class<? extends Component> navigationTarget)
getNavigationRouteTarget(String) and
retrieve the list of route layouts from the
RouteTarget contained in the
NavigationRouteTarget.This chain may be pre-defined or generated from annotation data.
path - path to use for resolving chainnavigationTarget - navigation target to get layout chain forRouteTarget.getParentLayouts()void update(Command command)
Any other thread trying to configure current registry will be blocked until the update has released all the locks.
command - command to execute for the updateRegistration addRoutesChangeListener(RoutesChangedListener listener)
listener - listener to be informed on route changesvoid clean()
Copyright © 2025. All rights reserved.