Class Routes
-
- All Implemented Interfaces:
-
java.io.Serializable
public final class Routes implements Serializable
A configuration object of all routes and error routes in the application. Simply use autoDiscoverViews to discover everything.
To speed up the tests, you can create one instance of this class only, then reuse that instance in every call to MockVaadin.setup.
-
-
Field Summary
Fields Modifier and Type Field Description private final Set<Class<out Component>>routesprivate final Set<Class<out HasErrorParameter<?>>>errorRoutesprivate BooleanskipPwaInit
-
Method Summary
Modifier and Type Method Description final Set<Class<out Component>>getRoutes()a list of all route views in your application. final Set<Class<out HasErrorParameter<?>>>getErrorRoutes()a list of all route views in your application. final BooleangetSkipPwaInit()if true, the PWA initialization code is skipped in Vaadin, which dramatically speeds up the MockVaadin.setup from 2 seconds to 50ms. final UnitsetSkipPwaInit(Boolean skipPwaInit)if true, the PWA initialization code is skipped in Vaadin, which dramatically speeds up the MockVaadin.setup from 2 seconds to 50ms. final Unitregister(VaadinContext sc)Registers all routes to Vaadin 15 registry. final RoutesautoDiscoverViews(String packageNames)Auto-discovers everything, registers it into thisand returnsthis.final RoutesautoDiscoverViews()Auto-discovers everything, registers it into thisand returnsthis.final Routesmerge(Routes other)StringtoString()-
-
Method Detail
-
getRoutes
final Set<Class<out Component>> getRoutes()
a list of all route views in your application. Vaadin will ignore any routes not present here.
-
getErrorRoutes
final Set<Class<out HasErrorParameter<?>>> getErrorRoutes()
a list of all route views in your application. Vaadin will ignore any routes not present here.
-
getSkipPwaInit
final Boolean getSkipPwaInit()
if true, the PWA initialization code is skipped in Vaadin, which dramatically speeds up the MockVaadin.setup from 2 seconds to 50ms. Since that's usually what you want to do, this defaults to true.
-
setSkipPwaInit
final Unit setSkipPwaInit(Boolean skipPwaInit)
if true, the PWA initialization code is skipped in Vaadin, which dramatically speeds up the MockVaadin.setup from 2 seconds to 50ms. Since that's usually what you want to do, this defaults to true.
-
register
final Unit register(VaadinContext sc)
Registers all routes to Vaadin 15 registry. Automatically called from MockVaadin.setup.
-
autoDiscoverViews
@JvmOverloads() final Routes autoDiscoverViews(String packageNames)
Auto-discovers everything, registers it into
thisand returnsthis.Route-annotated views go into routes
HasErrorParameter error views go into errorRoutes After this function finishes, you can still modify the routes and errorRoutes sets, for example you can clear the errorRoutes if there is some kind of misdetection.
- Parameters:
packageNames- set the package name for the detector to be faster; or provide null to scan the whole classpath, but this is quite slow.- Returns:
this
-
autoDiscoverViews
@JvmOverloads() final Routes autoDiscoverViews()
Auto-discovers everything, registers it into
thisand returnsthis.Route-annotated views go into routes
HasErrorParameter error views go into errorRoutes After this function finishes, you can still modify the routes and errorRoutes sets, for example you can clear the errorRoutes if there is some kind of misdetection.
- Returns:
this
-
-
-
-