com.vaadin.flow.router.internal.

Class RouteUtil


  • public class RouteUtil
    extends Object

    Utility class with methods for route handling.

    Since:

    1.3

    • Constructor Detail

      • RouteUtil

        protected RouteUtil()
    • Method Detail

      • getParentLayouts

        public static List<Class<? extends RouterLayout>> getParentLayouts(Class<?> component,
                                                                           String path)

        Get parent layouts for navigation target according to the Route or RouteAlias annotation.

        Parameters:

        component - navigation target to get parents for

        path - path used to get navigation target so we know which annotation to handle

        Returns:

        parent layouts for target

      • getRoutePath

        public static String getRoutePath(Class<?> component,
                                          Route route)

        Get the actual route path including all parent layout RoutePrefix.

        Parameters:

        component - navigation target component to get route path for

        route - route annotation to check

        Returns:

        actual path for given route target

      • getRouteAliasPath

        public static String getRouteAliasPath(Class<?> component,
                                               RouteAlias alias)

        Get the actual route path including all parent layout RoutePrefix.

        Parameters:

        component - navigation target component to get route path for

        alias - route alias annotation to check

        Returns:

        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 nor RouteAlias, but may still contain ParentLayout. Mainly error navigation targets.

        Parameters:

        navigationTarget - route to check parent layouts for

        Returns:

        list of parent layouts

      • getTopParentLayout

        public static Class<? extends RouterLayout> getTopParentLayout(Class<?> component,
                                                                       String path)

        Get the top most parent layout for navigation target according to the Route or RouteAlias annotation. Also handles non route targets with ParentLayout.

        Parameters:

        component - navigation target to get top most parent for

        path - 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

        public static String resolve(Class<?> component,
                                     Route route)

        Gets the effective route path value of the annotated class.

        Parameters:

        component - the component where the route points to

        route - the annotation

        Returns:

        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 registry

        addedClasses - added classes

        modifiedClasses - modified classes

        deletedClasses - deleted classes