Package com.vaadin.copilot
Class CopilotDebugViewRegistrar
java.lang.Object
com.vaadin.copilot.CopilotDebugViewRegistrar
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 withregisterAtStartup = true.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRoute prefix identifying a Copilot debug view. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidregisterDebugView(com.vaadin.flow.server.VaadinContext context, Class<?> hotswappedClass) Registers the given class if it is a Copilot debug view, i.e. a@Route-annotatedComponentwhose route value starts with "__copilot/".static voidregisterDebugViews(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.
-
Field Details
-
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, notnull
-
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-annotatedComponentwhose 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, notnullhotswappedClass- the class to register if it is a debug view, notnull
-