Package com.vaadin.copilot.javarewriter
Class JavaFileSourceProvider
java.lang.Object
com.vaadin.copilot.javarewriter.JavaFileSourceProvider
Provider that makes sure same JavaRewriter is served for the same file so
same file should not be overwritten in the same operation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all cachedJavaSourceobjects from memory.getJavaSource(File sourceFile) Retrieves aJavaSourcerepresentation of the specified Java source file.voidsaveComponentInfoSourceFiles(ComponentInfo componentInfo)
-
Field Details
-
UNDO_LABEL
-
-
Constructor Details
-
JavaFileSourceProvider
public JavaFileSourceProvider()
-
-
Method Details
-
getJavaSource
Retrieves aJavaSourcerepresentation of the specified Java source file.If the source has already been loaded previously, the cached
JavaSourceis returned. Otherwise, the file is read from disk, validated to ensure it is not a Kotlin file, and then parsed into a newJavaSourceinstance which is cached for future use.- Parameters:
sourceFile- the Java source file to load- Returns:
- the
JavaSourcerepresentation of the given file - Throws:
IOException- if an I/O error occurs while reading the fileKotlinNotSupportedException- if the file is determined to be a Kotlin file
-
saveComponentInfoSourceFiles
-
clear
public void clear()Clears all cachedJavaSourceobjects from memory.Note: This method should be called anytime a new Java related operation begins.
-