Class SourceSyncChecker

java.lang.Object
com.vaadin.copilot.javarewriter.SourceSyncChecker

public class SourceSyncChecker extends Object
The SourceSyncChecker is responsible for monitoring changes to Java source files during development to identify scenarios where source files may be out of sync with the running application or route view is deleted by the user.
  • Constructor Details

    • SourceSyncChecker

      public SourceSyncChecker(com.vaadin.flow.internal.DevModeHandlerManager devModeHandler)
      Starts the source file watcher with the given application configuration.
      Parameters:
      devModeHandler - flow dev mode handler for registering file watcher shut down
  • Method Details

    • maybeOutOfSync

      public boolean maybeOutOfSync(ComponentInfoNotFoundException exception)
      Looks for file has been updated since the startup. Additionally, caches exceptions that happens without any files changes.
      Parameters:
      exception - Exception that happens when finding component info fails.
      Returns:
      true if file may be out of sync, false otherwise
    • addDeletedView

      public void addDeletedView(String qualifiedClassName)
      Stores the given class name as the view is removed
      Parameters:
      qualifiedClassName - fully qualified class name of a view
    • addDeletedView

      public void addDeletedView(com.vaadin.flow.component.Component component)
      Stores component class into the deleted views list so that SuggestRestartException can be thrown when it is requested
      Parameters:
      component - Flow node
    • throwIfViewDeleted

      public void throwIfViewDeleted(ComponentTypeAndSourceLocation componentTypeAndSourceLocation) throws SuggestRestartException
      Throws an exception if class from the given componentTypeAndSourceLocation is deleted during the lifetime of the application.
      Parameters:
      componentTypeAndSourceLocation -
      Throws:
      SuggestRestartException - is thrown when file is not present
    • isViewDeleted

      public boolean isViewDeleted(String qualifiedClassName)