Package com.vaadin.copilot.javarewriter
Class SourceSyncChecker
java.lang.Object
com.vaadin.copilot.javarewriter.SourceSyncChecker
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 Summary
ConstructorsConstructorDescriptionSourceSyncChecker(com.vaadin.flow.internal.DevModeHandlerManager devModeHandler) Starts the source file watcher with the given application configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeletedView(com.vaadin.flow.component.Component component) Stores component class into the deleted views list so thatSuggestRestartExceptioncan be thrown when it is requestedvoidaddDeletedView(String qualifiedClassName) Stores the given class name as the view is removedbooleanisViewDeleted(String qualifiedClassName) booleanmaybeOutOfSync(ComponentInfoNotFoundException exception) Looks for file has been updated since the startup.voidthrowIfViewDeleted(ComponentTypeAndSourceLocation componentTypeAndSourceLocation) Throws an exception if class from the givencomponentTypeAndSourceLocationis deleted during the lifetime of the application.
-
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
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
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 thatSuggestRestartExceptioncan 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 givencomponentTypeAndSourceLocationis deleted during the lifetime of the application.- Parameters:
componentTypeAndSourceLocation-- Throws:
SuggestRestartException- is thrown when file is not present
-
isViewDeleted
-