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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Routes(Set<Class<out Component>> routes, Set<Class<out HasErrorParameter<?>>> errorRoutes, Boolean skipPwaInit)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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 Boolean getSkipPwaInit() if true, the PWA initialization code is skipped in Vaadin, which dramatically speeds up the MockVaadin.setup from 2 seconds to 50ms.
      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.
      final Unit register(VaadinContext sc) Registers all routes to Vaadin 15 registry.
      final Routes autoDiscoverViews(String packageNames) Auto-discovers everything, registers it into this and returns this.
      final Routes autoDiscoverViews() Auto-discovers everything, registers it into this and returns this.
      final Routes merge(Routes other)
      String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Routes

        Routes(Set<Class<out Component>> routes, Set<Class<out HasErrorParameter<?>>> errorRoutes, Boolean skipPwaInit)
    • 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.

      • autoDiscoverViews

        @JvmOverloads() final Routes autoDiscoverViews(String packageNames)

        Auto-discovers everything, registers it into this and returns this.

        • 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 this and returns this.

        • 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