Package com.vaadin.copilot.javarewriter
Class JavaModifier
java.lang.Object
com.vaadin.copilot.javarewriter.JavaModifier
A utility class for modifying Java source code.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A class for performing operations on a CompilationUnit.static interface
A functional interface for operations that modify a CompilationUnit. -
Constructor Summary
ConstructorsConstructorDescriptionJavaModifier
(ProjectManager projectManager) Creates a modifier for the given project -
Method Summary
Modifier and TypeMethodDescriptionmodify
(Class<?> cls, JavaModifier.OperationFunction<JavaModifier.CompilationUnitOperations> operations) Modifies the source code of the given class using the provided operations.
-
Constructor Details
-
JavaModifier
Creates a modifier for the given project- Parameters:
projectManager
- The project manager to use for file operations
-
-
Method Details
-
modify
public Map<File,String> modify(Class<?> cls, JavaModifier.OperationFunction<JavaModifier.CompilationUnitOperations> operations) throws IOException Modifies the source code of the given class using the provided operations.- Parameters:
cls
- The class to modify.operations
- The operations to perform on the class.- Returns:
- A map of modified files and their new content.
- Throws:
IOException
- If an error occurs
-