public class JavaParserMerger extends CodeSnipitMerger
CodeSnipits into java lass files.| Constructor and Description |
|---|
JavaParserMerger() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
executeMerge(JavaForgerConfiguration config,
CodeSnipit codeSnipit,
String mergeClassPath)
Merges the input
CodeSnipit with the mergeClass given by the JavaForgerConfiguration. |
protected void |
write(com.github.javaparser.ast.CompilationUnit existingCode,
PrintWriter writer) |
protected void |
write(String className,
com.github.javaparser.ast.CompilationUnit existingCode) |
format, merge, validateprotected void executeMerge(JavaForgerConfiguration config, CodeSnipit codeSnipit, String mergeClassPath) throws IOException
CodeSnipit with the mergeClass given by the JavaForgerConfiguration. Currently only codeSnipits are supported that are not
a complete class. Imports are also not supported. Inside this method we wrap the code within the codeSnipit in a class and let JavaParser read it.
Then everything inside the wrapped class will be inserted into the inputClass. Variables with the same name and Methods with the same name and signature
will be replaced in the mergeClass. Changes will be written directly in the mergeClass.executeMerge in class CodeSnipitMergerconfig - The JavaForgerConfiguration containing merge settings and the path of the class to merge with.codeSnipit - The CodeSnipit which will be merged into the input class.mergeClassPath - The path to the class to merge withIOException - If the mergeClassPath does not existprotected void write(String className, com.github.javaparser.ast.CompilationUnit existingCode) throws IOException
IOExceptionprotected void write(com.github.javaparser.ast.CompilationUnit existingCode,
PrintWriter writer)
throws IOException
IOExceptionCopyright © 2019. All rights reserved.