Class CopilotDebugViewRegistrar

java.lang.Object
com.vaadin.copilot.CopilotDebugViewRegistrar

public final class CopilotDebugViewRegistrar extends Object
Registers Copilot debug views.

These are views that ship with (or are generated by) Copilot and that should only be reachable while Copilot is running in a development / debug session. They are annotated with @Route(value = "__copilot/...", registerAtStartup = false) so that Flow does not register them automatically. Instead, Copilot registers them explicitly, so that they are available only in debug mode and never leak into a production build.

Registration happens at two points:

  • on start up, registerDebugViews(VaadinContext) scans the project for such views (they are missing from the registry because Flow skipped them);
  • at runtime, registerDebugView(VaadinContext, Class) is called from the hotswap listener for each hotswapped class, so a debug view created while the application is running becomes available without a restart. This is needed because Flow's own hotswap route update only registers views with registerAtStartup = true.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Route prefix identifying a Copilot debug view.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    registerDebugView(com.vaadin.flow.server.VaadinContext context, Class<?> hotswappedClass)
    Registers the given class if it is a Copilot debug view, i.e. a @Route-annotated Component whose route value starts with "__copilot/".
    static void
    registerDebugViews(com.vaadin.flow.server.VaadinContext context)
    Scans the project for @Route-annotated views whose route value starts with "__copilot/" and registers them on the application route registry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ROUTE_PREFIX

      public static final String ROUTE_PREFIX
      Route prefix identifying a Copilot debug view.
      See Also:
  • Method Details

    • registerDebugViews

      public static void registerDebugViews(com.vaadin.flow.server.VaadinContext context)
      Scans the project for @Route-annotated views whose route value starts with "__copilot/" and registers them on the application route registry.
      Parameters:
      context - the current Vaadin context, not null
    • registerDebugView

      public static void registerDebugView(com.vaadin.flow.server.VaadinContext context, Class<?> hotswappedClass)
      Registers the given class if it is a Copilot debug view, i.e. a @Route-annotated Component whose route value starts with "__copilot/". Any other class is ignored.

      Intended to be called for every hotswapped class so that debug views created while the application is running become available without a restart.

      Parameters:
      context - the current Vaadin context, not null
      hotswappedClass - the class to register if it is a debug view, not null