Annotation Interface Route


Defines the route template suffix for components that function as navigation targets in routing.

The route template of the navigation target is composed of the values of all RoutePrefix annotated on the layout() and ParentLayout class values, starting from the root parent and joined together using slash delimiter to form a path form string.

There is also RouteAlias annotation which may be declared in addition to this annotation and may be used multiple times.

Since:
1.0
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Ignore route prefixes from parent layouts and only use the path defined in this annotation.
    boolean
    Marks if Route should apply a Layout matching route value when no layout() defined.
    boolean
    Defines if the route is available only when running in development mode or if it is always available.
    Class<? extends RouterLayout>
    Sets the parent component for the route target component.
    boolean
    Marks if this Route should be registered during the initial route registration on servlet startup.
    Sets the route template suffix value of the annotated class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Field Details

  • Element Details

    • value

      String value
      Sets the route template suffix value of the annotated class.

      If no value is provided, the path will be derived from the class name of the component. The derived name will be in lower case and trailing "View" will be removed. Also, MainView or Main names will be mapped to root (value will be "").

      This value accepts also parameter template segments which can be defined using following format: :parameterName[?|*][(regex)].

      Note for framework developers: do not use the value directly, but use the helper method RouteUtil.resolve(VaadinContext, Class), so that naming convention based values are dealt correctly.

      Returns:
      the explicit path value of this route
      Default:
      "___NAMING_CONVENTION___"
    • layout

      Class<? extends RouterLayout> layout
      Sets the parent component for the route target component.

      When navigating between components that use the same layout, the same component instance is reused. Default layout target is the UI, but the layout should not be a custom UI as UI is a special class used to know where the route stack ends and no parent layouts should be involved.

      All layout stacks will be appended to the UI as it represents the Body element.

      Returns:
      the layout component class used by the route target component.
      See Also:
      Default:
      com.vaadin.flow.component.UI.class
    • absolute

      boolean absolute
      Ignore route prefixes from parent layouts and only use the path defined in this annotation.
      Returns:
      true to ignore parent layout prefixes, false otherwise
      Default:
      false
    • registerAtStartup

      boolean registerAtStartup
      Marks if this Route should be registered during the initial route registration on servlet startup.

      Default is to register route at startup.

      Returns:
      setting to false skips automatic registration
      Since:
      1.3
      Default:
      true
    • autoLayout

      boolean autoLayout
      Marks if Route should apply a Layout matching route value when no layout() defined. If set to false no layout will be searched for.
      Returns:
      false skips automatic layout
      Since:
      24.5
      Default:
      true
    • developmentOnly

      boolean developmentOnly
      Defines if the route is available only when running in development mode or if it is always available.

      A development only route is not registered from this annotation when the application runs in production mode. This applies both to the automatic registration at startup and to RouteConfiguration.setAnnotatedRoute(Class), and to any RouteAlias of the class. Use it for views that are meant only for development, such as debugging tools or example views kept in the project, and that must not be reachable in production.

      Registering the class explicitly on a path, for example through RouteConfiguration.setRoute(String, Class), does not read this annotation and is not affected.

      By default, routes are always available.

      Returns:
      true to make the route available only in development mode, false to always make it available
      Default:
      false