Interface VaadinHotswapper

All Known Implementing Classes:
DefaultTranslationsHotswapper, ReflectionCacheHotswapper, RouteRegistryHotswapper, StyleSheetHotswapper

public interface VaadinHotswapper
Implementors of this interface are responsible for update Vaadin components when application classes change.

Listener instances are by default discovered using Flow Lookup mechanisms. Implementors are usually discovered and instantiated using ServiceLoader, meaning that all implementations must have a zero-argument constructor and the fully qualified name of the implementation class must be listed on a separate line in a META-INF/services/com.vaadin.flow.hotswap.VaadinHotSwapper file present in the jar file containing the implementation class. Integrations for specific runtime environments, such as Spring and CDI, might also provide other ways of discovering implementors.

For internal use only. May be renamed or removed in a future release.

Since:
24.5
Author:
Vaadin Ltd
  • Method Details

    • onInit

      default void onInit(com.vaadin.flow.server.VaadinService vaadinService)
      Called during the initialization of the Vaadin Hotswapper. This method provides an entry point for executing logic that needs to occur when the associated VaadinService is initialized and before any hotswap events are triggered.
      Parameters:
      vaadinService - the active VaadinService instance being initialized
      Since:
      25.0
    • onClassLoadEvent

      @Deprecated(since="25.0", forRemoval=true) default boolean onClassLoadEvent(com.vaadin.flow.server.VaadinService vaadinService, Set<Class<?>> classes, boolean redefined)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of 25.0, replaced by onClassesChange(HotswapClassEvent). Please consider moving your implementation to that method.
      Called by Vaadin hotswap entry point when one or more application classes have been updated.

      This method is meant to perform application-wide updates. Operation targeting Vaadin session should be implemented in onClassLoadEvent(VaadinSession, Set, boolean) method.

      Parameters:
      vaadinService - active VaadinService instance.
      classes - the set of changed classes.
      redefined - true if the classes have been redefined by hotswap mechanism, false if they have been loaded for the first time by the ClassLoader.
      Returns:
      true if a browser page reload is required, false otherwise.
      See Also:
    • onClassesChange

      default void onClassesChange(HotswapClassEvent event)
      Called by Vaadin hotswap entry point when one or more application classes have been updated.

      This method is meant to perform application-wide updates. Operation targeting Vaadin session should be implemented in onClassesChange(HotswapClassSessionEvent) method.

      Currently, the default implementation delegates to the deprecated onClassLoadEvent(VaadinService, Set, boolean) method for backward compatibility.

      Parameters:
      event - the event instance carrying the information about the changed classes.
      Since:
      25.0
      See Also:
    • onClassLoadEvent

      @Deprecated(since="25.0", forRemoval=true) default boolean onClassLoadEvent(com.vaadin.flow.server.VaadinSession vaadinSession, Set<Class<?>> classes, boolean redefined)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of 25.0, replaced by onClassesChange(HotswapClassSessionEvent). Please consider moving your implementation to that method.
      Called by Vaadin hotswap entry point when one or more application classes have been updated.

      This method is meant to perform updates at VaadinSession level. Operation targeting the entire application should be implemented in onClassLoadEvent(VaadinService, Set, boolean) method.

      Parameters:
      vaadinSession - the VaadinSession to be potentially updated.
      classes - the set of changed classes.
      redefined - true if the classes have been redefined by hotswap mechanism, false if they have been loaded for the first time by the ClassLoader.
      Returns:
      true if a browser page reload is required, false otherwise.
      See Also:
    • onClassesChange

      default void onClassesChange(HotswapClassSessionEvent event)
      Called by Vaadin hotswap entry point when one or more application classes have been updated.

      This method is meant to perform updates at VaadinSession level. Operation targeting the entire application should be implemented in onClassesChange(HotswapClassEvent) method.

      Currently, the default implementation delegates to the deprecated onClassLoadEvent(VaadinSession, Set, boolean) method for backward compatibility.

      Parameters:
      event - the event instance carrying the information about the changed classes.
      Since:
      25.0
      See Also:
    • onResourcesChange

      default void onResourcesChange(HotswapResourceEvent event)
      Called by Vaadin hotswap entry point when one or more application resources have been updated.

      This method is meant to perform application-wide updates, involving all active UI instances.

      Parameters:
      event - the event instance carrying the information about the changed resources.
      Since:
      25.0
    • onHotswapComplete

      default void onHotswapComplete(HotswapCompleteEvent event)
      Called by Vaadin hotswap entry point after all hotswap related operations have been completed.
      Parameters:
      event - an event containing information about the hotswap operation.