public class SourceRoot extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
SourceRoot.Callback |
Constructor and Description |
---|
SourceRoot(Path root) |
Modifier and Type | Method and Description |
---|---|
void |
add(String pkg,
String filename,
CompilationUnit compilationUnit)
Add a newly created Java file to this source root.
|
List<CompilationUnit> |
getCompilationUnits()
The CompilationUnits of the Java files that have been parsed succesfully by this source root object,
or have been added manually.
|
Map<Path,ParseResult<CompilationUnit>> |
getContent()
The Java files that have been parsed by this source root object,
or have been added manually.
|
JavaParser |
getJavaParser() |
Path |
getRoot()
The path that was passed in the constructor.
|
void |
parse(String startPackage,
JavaParser javaParser,
SourceRoot.Callback callback)
Parses a package recursively with a callback.
|
CompilationUnit |
parse(String packag,
String filename)
Try to parse a single Java file and return it.
|
void |
saveAll()
Save all files back to where they were found.
|
void |
saveAll(Path root)
Save all files back to another path.
|
SourceRoot |
setJavaParser(JavaParser javaParser) |
Map<Path,ParseResult<CompilationUnit>> |
tryToParse()
Parse every .java file in this source root.
|
Map<Path,ParseResult<CompilationUnit>> |
tryToParse(String startPackage)
Parses all .java files in a package recursively, caches them, and returns all files ever parsed with this source
root.
|
ParseResult<CompilationUnit> |
tryToParse(String packag,
String filename)
Try to parse a single Java file and return the result of parsing.
|
public SourceRoot(Path root)
public Map<Path,ParseResult<CompilationUnit>> tryToParse(String startPackage) throws IOException
IOException
public void parse(String startPackage, JavaParser javaParser, SourceRoot.Callback callback) throws IOException
IOException
public Map<Path,ParseResult<CompilationUnit>> tryToParse() throws IOException
IOException
public void saveAll() throws IOException
IOException
public void saveAll(Path root) throws IOException
IOException
public Map<Path,ParseResult<CompilationUnit>> getContent()
public List<CompilationUnit> getCompilationUnits()
public ParseResult<CompilationUnit> tryToParse(String packag, String filename) throws IOException
IOException
public CompilationUnit parse(String packag, String filename)
ParseProblemException
- when something went wrong.public void add(String pkg, String filename, CompilationUnit compilationUnit)
public Path getRoot()
public JavaParser getJavaParser()
public SourceRoot setJavaParser(JavaParser javaParser)
Copyright © 2007–2017. All rights reserved.