com.vaadin.flow.router.internal.

Class ConfigureRoutes

    • Constructor Detail

      • ConfigureRoutes

        public ConfigureRoutes()

        Create an immutable RouteConfiguration.

      • ConfigureRoutes

        public ConfigureRoutes(ConfiguredRoutes original)

        Create a mutable or immutable configuration with original configuration information.

        Parameters:

        original - original configuration to get data from

    • Method Detail

      • clear

        public void clear()

        Clear all maps from this configuration.

      • setRoute

        public void setRoute(String path,
                             Class<? extends Component> navigationTarget)

        Set a new RouteTarget for the given path.

        Note! this will override any previous value.

        Parameters:

        path - path for which to set route target for

        navigationTarget - navigation target to add

      • setTargetRoute

        public void setTargetRoute(Class<? extends Component> navigationTarget,
                                   String path)

        Put a new target route for Class-to-path mapping.

        This is a reverse mapping to RouteTarget, which also handles any HasUrl parameters, for the main route of this navigation target.

        Parameters:

        navigationTarget - navigation target to map

        path - path for given navigation target

      • setErrorRoute

        public void setErrorRoute(Class<? extends Exception> exception,
                                  Class<? extends Component> errorTarget)

        Set a error route to the configuration.

        Any exception handler set for a existing error will override the old exception handler.

        Parameters:

        exception - exception handled by error route

        errorTarget - error navigation target

      • removeRoute

        public void removeRoute(Class<? extends Component> targetRoute)

        Remove the targetRoute completely from the configuration.

        Parameters:

        targetRoute - target registered route to remove

      • removeRoute

        public void removeRoute(String path)

        Remove route for given path. This will remove all targets registered for given path.

        In case there exists another path mapping for any of the removed route targets the main class-to-string mapping will be updated to the first found.

        Parameters:

        path - path from which to remove routes from

      • removeRoute

        public void removeRoute(String path,
                                Class<? extends Component> targetRoute)

        Remove specific navigation target for given route. The path will still exist if there is another target with different parameters registered to it. If no targets remain the path will be removed completely.

        In case there exists another path mapping for the removed route target the main class-to-string mapping will be updated to the first found.

        Parameters:

        path - path to remove target from

        targetRoute - target route to remove from path