public class CodeSnipitReader extends Object
| Constructor and Description |
|---|
CodeSnipitReader() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
firstIndexAfterImports(String string) |
protected int |
getFirstIndexAfterComment(String string) |
protected boolean |
hasClassDefined(String string) |
protected com.github.javaparser.ParseResult<com.github.javaparser.ast.ImportDeclaration> |
parseImport(String declaration) |
protected com.github.javaparser.ParseResult<com.github.javaparser.ast.PackageDeclaration> |
parsePackage(String declaration) |
com.github.javaparser.ast.CompilationUnit |
read(CodeSnipit codeSnipit,
String classPath)
|
protected com.github.javaparser.ast.CompilationUnit |
read(String className) |
protected com.github.javaparser.ast.CompilationUnit |
readClass(String completeClass) |
String |
toCompleteClass(CodeSnipit codeSnipit,
String mergeClassPath)
Converts a
CodeSnipit to a String representing a full class. |
public com.github.javaparser.ast.CompilationUnit read(CodeSnipit codeSnipit, String classPath)
codeSnipit - The CodeSnipit to be read.classPath - The path to the class to which this is going to be merged. Needed to append the class name if the CodeSnipit has no class name
defined.CompilationUnit of the input codepublic String toCompleteClass(CodeSnipit codeSnipit, String mergeClassPath)
CodeSnipit to a String representing a full class. If the codeSnipit does not have a class defined, the code is wrapped into a class
taking into account possible imports or package definition.codeSnipit - The CodeSnipit to convert.mergeClassPath - The path to the class to which this will eventually be merged. Needed to determine the class name if the codeSnipit does not contain
one.protected com.github.javaparser.ast.CompilationUnit readClass(String completeClass)
protected com.github.javaparser.ast.CompilationUnit read(String className) throws IOException
IOExceptionprotected int firstIndexAfterImports(String string)
protected int getFirstIndexAfterComment(String string)
protected com.github.javaparser.ParseResult<com.github.javaparser.ast.PackageDeclaration> parsePackage(String declaration)
protected com.github.javaparser.ParseResult<com.github.javaparser.ast.ImportDeclaration> parseImport(String declaration)
protected boolean hasClassDefined(String string)
Copyright © 2019. All rights reserved.