com.vaadin.flow.router.internal.
Class RouteUtil
Utility class with methods for route handling.
For internal use only. May be renamed or removed in a future release.
Since:
1.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<Class<? extends RouterLayout>>
getParentLayouts
(VaadinContext context, Class<?> component, String path) Get parent layouts for navigation target according to the
Route
orRouteAlias
annotation.static List<Class<? extends RouterLayout>>
getParentLayoutsForNonRouteTarget
(Class<?> navigationTarget) Collect possible route parent layouts for a navigation target that is not annotated with
Route
norRouteAlias
, but may still containParentLayout
.static String
getRouteAliasPath
(Class<?> component, RouteAlias alias) Get the actual route path including all parent layout
RoutePrefix
.static String
getRoutePath
(VaadinContext context, Class<?> component) Get the actual route path including all parent layout
RoutePrefix
.static Class<? extends RouterLayout>
getTopParentLayout
(VaadinContext context, Class<?> component, String path) Get the top most parent layout for navigation target according to the
Route
orRouteAlias
annotation.static String
resolve
(VaadinContext context, Class<?> component) Gets the effective route path value of the annotated class.
static void
updateRouteRegistry
(RouteRegistry registry, Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses, Set<Class<?>> deletedClasses) Updates route registry as necessary when classes have been added / modified / deleted.
-
Constructor Details
-
RouteUtil
protected RouteUtil()
-
-
Method Details
-
getParentLayouts
public static List<Class<? extends RouterLayout>> getParentLayouts(VaadinContext context, Class<?> component, String path) Get parent layouts for navigation target according to the
Route
orRouteAlias
annotation.Parameters:
context
- a Vaadin contextcomponent
- navigation target to get parents forpath
- path used to get navigation target so we know which annotation to handleReturns:
parent layouts for target
-
getRoutePath
Get the actual route path including all parent layout
RoutePrefix
.Parameters:
context
- a Vaadin contextcomponent
- navigation target component to get route path forReturns:
actual path for given route target
-
getRouteAliasPath
Get the actual route path including all parent layout
RoutePrefix
.Parameters:
component
- navigation target component to get route path foralias
- route alias annotation to checkReturns:
actual path for given route alias target
-
getParentLayoutsForNonRouteTarget
public static List<Class<? extends RouterLayout>> getParentLayoutsForNonRouteTarget(Class<?> navigationTarget) Collect possible route parent layouts for a navigation target that is not annotated with
Route
norRouteAlias
, but may still containParentLayout
. Mainly error navigation targets.Parameters:
navigationTarget
- route to check parent layouts forReturns:
list of parent layouts
-
getTopParentLayout
public static Class<? extends RouterLayout> getTopParentLayout(VaadinContext context, Class<?> component, String path) Get the top most parent layout for navigation target according to the
Route
orRouteAlias
annotation. Also handles non route targets withParentLayout
.Parameters:
component
- navigation target to get top most parent forpath
- path used to get navigation target so we know which annotation to handle or null for error views.Returns:
top parent layout for target or null if none found
-
resolve
Gets the effective route path value of the annotated class.
Parameters:
context
- a Vaadin contextcomponent
- the component where the route points toReturns:
The value of the annotation or naming convention based value if no explicit value is given.
-
updateRouteRegistry
public static void updateRouteRegistry(RouteRegistry registry, Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses, Set<Class<?>> deletedClasses) Updates route registry as necessary when classes have been added / modified / deleted.
Parameters:
registry
- route registryaddedClasses
- added classesmodifiedClasses
- modified classesdeletedClasses
- deleted classes
-