| Modifier and Type | Class and Description |
|---|---|
| public static interface | |
| private static class | SourceRoot.
Executes a recursive file tree walk using threads. |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private static final Pattern | |
| private ParserConfiguration | |
| private Function | |
| private final Path |
| Access | Constructor and Description |
|---|---|
| public | SourceRoot(Path
the root directory of a set of source files. It corresponds to the root of the package structure of the
source files within, like "javaparser/javaparser-core/src/main/java" root)
|
| public | SourceRoot(Path
the root directory of a set of source files. It corresponds to the root of the package structure of the
source files within, like "javaparser/javaparser-core/src/main/java" root, ParserConfiguration parserConfiguration)
|
| Modifier and Type | Method and Description |
|---|---|
| public SourceRoot | add(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage, String filename, CompilationUnit compilationUnit)Add a newly created Java file to the cache of this source root. |
| public SourceRoot | |
| private FileVisitResult | |
| public List | getCache()
The Java files that have been parsed by this source root object, or have been added manually. |
| public List | getCompilationUnits()
The CompilationUnits of the Java files that have been parsed succesfully by this source root object, or have been added manually. |
| public ParserConfiguration | |
| public Function | |
| public Path | |
| private static boolean | |
| private void | |
| public CompilationUnit | |
| public SourceRoot | parse(String
The package containing the file startPackage, String The name of the file filename, ParserConfiguration configuration, SourceRoot.Locates the .java file with the provided package and file name, parses it and passes it to the callback. |
| public SourceRoot | parse(String startPackage, String filename, SourceRoot.
Parses the provided .java file and passes it to the callback. |
| public SourceRoot | parse(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage, ParserConfiguration configuration, SourceRoot.Tries to parse all .java files in a package recursively and passes them one by one to the callback. |
| public SourceRoot | |
| public SourceRoot | parseParallelized(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage, ParserConfiguration configuration, SourceRoot.Tries to parse all .java files in a package recursively using multiple threads, and passes them one by one to the callback. |
| public SourceRoot | parseParallelized(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage, SourceRoot.Tries to parse all .java files in a package recursively using multiple threads, and passes them one by one to the callback. |
| public SourceRoot | parseParallelized(SourceRoot.
Tries to parse all .java files recursively using multiple threads, and passes them one by one to the callback. |
| private SourceRoot | save(CompilationUnit
the compilation unit cu, Path the path of the java file path)Save the given compilation unit to the given path. |
| private SourceRoot | save(CompilationUnit
the compilation unit cu, Path the path of the java file path, Charset the encoding to use while saving the file encoding)Save the given compilation unit to the given path. |
| public SourceRoot | |
| public SourceRoot | |
| public SourceRoot | |
| public SourceRoot | |
| public SourceRoot | setParserConfiguration(ParserConfiguration parserConfiguration)
Set the parser configuration that is used for parsing when no configuration is passed to a method. |
| public SourceRoot | setPrinter(Function<CompilationUnit, String> printer)
Set the printing function that transforms compilation units into a string to save. |
| public String | |
| public ParseResult | tryToParse(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage, String filename, ParserConfiguration configuration)Tries to parse a .java files under the source root and returns the ParseResult. |
| public ParseResult | tryToParse(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage, String filename)Tries to parse a .java files under the source root and returns the ParseResult. |
| public List | tryToParse(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage)Tries to parse all .java files in a package recursively, and returns all files ever parsed with this source root. |
| public List | tryToParse()
Tries to parse all .java files under the source root recursively, and returns all files ever parsed with this source root. |
| public List | tryToParseParallelized(String
files in this package and deeper are parsed. Pass "" to parse all files. startPackage)Tries to parse all .java files in a package recursively using multiple threads, and returns all files ever parsed with this source root. |
| public List | tryToParseParallelized()
Tries to parse all .java files under the source root recursively using multiple threads, and returns all files ever parsed with this source root. |
| cache | back to summary |
|---|---|
| private final Map<Path, ParseResult<CompilationUnit>> cache | |
| JAVA_IDENTIFIER | back to summary |
|---|---|
| private static final Pattern JAVA_IDENTIFIER | |
| parserConfiguration | back to summary |
|---|---|
| private ParserConfiguration parserConfiguration | |
| printer | back to summary |
|---|---|
| private Function<CompilationUnit, String> printer | |
| root | back to summary |
|---|---|
| private final Path root | |
| SourceRoot | back to summary |
|---|---|
public SourceRoot(Path root)
| |
| SourceRoot | back to summary |
|---|---|
public SourceRoot(Path root, ParserConfiguration parserConfiguration)
| |
| add | back to summary |
|---|---|
| public SourceRoot add(String startPackage, String filename, CompilationUnit compilationUnit) Add a newly created Java file to the cache of this source root. It will be saved when saveAll is called.
| |
| add | back to summary |
|---|---|
| public SourceRoot add(CompilationUnit compilationUnit) Add a newly created Java file to the cache of this source root. It will be saved when saveAll is called. It needs to have its path set. | |
| callback | back to summary |
|---|---|
| private FileVisitResult callback(Path absolutePath, ParserConfiguration configuration, SourceRoot. | |
| getCache | back to summary |
|---|---|
| public List The Java files that have been parsed by this source root object, or have been added manually. | |
| getCompilationUnits | back to summary |
|---|---|
| public List The CompilationUnits of the Java files that have been parsed succesfully by this source root object, or have been added manually. | |
| getParserConfiguration | back to summary |
|---|---|
| public ParserConfiguration getParserConfiguration() | |
| getPrinter | back to summary |
|---|---|
| public Function Get the printing function. | |
| getRoot | back to summary |
|---|---|
| public Path getRoot() The path that was passed in the constructor. | |
| isSensibleDirectoryToEnter | back to summary |
|---|---|
| private static boolean isSensibleDirectoryToEnter(Path dir) throws IOException | |
| logPackage | back to summary |
|---|---|
| private void logPackage(String startPackage) | |
| parse | back to summary |
|---|---|
| public CompilationUnit parse(String startPackage, String filename) Parses a .java files under the source root and returns its CompilationUnit. It keeps track of the parsed file so you can write it out with the saveAll() call. Note that the cache grows with every file parsed, so if you don't need saveAll(), or you don't ask SourceRoot to parse files multiple times (where the cache is useful) you might want to use the parse method with a callback.
| |
| parse | back to summary |
|---|---|
| public SourceRoot parse(String startPackage, String filename, ParserConfiguration configuration, SourceRoot. Locates the .java file with the provided package and file name, parses it and passes it to the callback. In comparison to the other parse methods, this is much more memory efficient, but saveAll() won't work. | |
| parse | back to summary |
|---|---|
| public SourceRoot parse(String startPackage, String filename, SourceRoot. Parses the provided .java file and passes it to the callback. In comparison to the other parse methods, this makes is much more memory efficient., but saveAll() won't work. | |
| parse | back to summary |
|---|---|
| public SourceRoot parse(String startPackage, ParserConfiguration configuration, SourceRoot. Tries to parse all .java files in a package recursively and passes them one by one to the callback. In comparison to the other parse methods, this is much more memory efficient, but saveAll() won't work.
| |
| parse | back to summary |
|---|---|
| public SourceRoot parse(String startPackage, SourceRoot. | |
| parseParallelized | back to summary |
|---|---|
| public SourceRoot parseParallelized(String startPackage, ParserConfiguration configuration, SourceRoot. Tries to parse all .java files in a package recursively using multiple threads, and passes them one by one to the
callback. A new thread is forked each time a new directory is visited and is responsible for parsing all .java
files in that directory. Note that the provided
| |
| parseParallelized | back to summary |
|---|---|
| public SourceRoot parseParallelized(String startPackage, SourceRoot. Tries to parse all .java files in a package recursively using multiple threads, and passes them one by one to the
callback. A new thread is forked each time a new directory is visited and is responsible for parsing all .java
files in that directory. Note that the provided
| |
| parseParallelized | back to summary |
|---|---|
| public SourceRoot parseParallelized(SourceRoot. Tries to parse all .java files recursively using multiple threads, and passes them one by one to the callback. A
new thread is forked each time a new directory is visited and is responsible for parsing all .java files in that
directory. Note that the provided | |
| save | back to summary |
|---|---|
| private SourceRoot save(CompilationUnit cu, Path path) Save the given compilation unit to the given path.
| |
| save | back to summary |
|---|---|
| private SourceRoot save(CompilationUnit cu, Path path, Charset encoding) Save the given compilation unit to the given path.
| |
| saveAll | back to summary |
|---|---|
| public SourceRoot saveAll(Path root, Charset encoding) Save all previously parsed files back to a new path. | |
| saveAll | back to summary |
|---|---|
| public SourceRoot saveAll(Path root) Save all previously parsed files back to a new path.
| |
| saveAll | back to summary |
|---|---|
| public SourceRoot saveAll() Save all previously parsed files back to where they were found. | |
| saveAll | back to summary |
|---|---|
| public SourceRoot saveAll(Charset encoding) Save all previously parsed files back to where they were found, with the given encoding.
| |
| setParserConfiguration | back to summary |
|---|---|
| public SourceRoot setParserConfiguration(ParserConfiguration parserConfiguration) Set the parser configuration that is used for parsing when no configuration is passed to a method. | |
| setPrinter | back to summary |
|---|---|
| public SourceRoot setPrinter(Function<CompilationUnit, String> printer) Set the printing function that transforms compilation units into a string to save. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| tryToParse | back to summary |
|---|---|
| public ParseResult Tries to parse a .java files under the source root and returns the ParseResult. It keeps track of the parsed file so you can write it out with the saveAll() call. Note that the cache grows with every file parsed, so if you don't need saveAll(), or you don't ask SourceRoot to parse files multiple times (where the cache is useful) you might want to use the parse method with a callback.
| |
| tryToParse | back to summary |
|---|---|
| public ParseResult Tries to parse a .java files under the source root and returns the ParseResult. It keeps track of the parsed file so you can write it out with the saveAll() call. Note that the cache grows with every file parsed, so if you don't need saveAll(), or you don't ask SourceRoot to parse files multiple times (where the cache is useful) you might want to use the parse method with a callback.
| |
| tryToParse | back to summary |
|---|---|
| public List Tries to parse all .java files in a package recursively, and returns all files ever parsed with this source root. It keeps track of all parsed files so you can write them out with a single saveAll() call. Note that the cache grows with every file parsed, so if you don't need saveAll(), or you don't ask SourceRoot to parse files multiple times (where the cache is useful) you might want to use the parse method with a callback.
| |
| tryToParse | back to summary |
|---|---|
| public List Tries to parse all .java files under the source root recursively, and returns all files ever parsed with this source root. It keeps track of all parsed files so you can write them out with a single saveAll() call. Note that the cache grows with every file parsed, so if you don't need saveAll(), or you don't ask SourceRoot to parse files multiple times (where the cache is useful) you might want to use the parse method with a callback. | |
| tryToParseParallelized | back to summary |
|---|---|
| public List Tries to parse all .java files in a package recursively using multiple threads, and returns all files ever parsed
with this source root. A new thread is forked each time a new directory is visited and is responsible for parsing
all .java files in that directory. Note that to ensure thread safety, a new parser instance is created for
every file with the internal parser's (i.e.
| |
| tryToParseParallelized | back to summary |
|---|---|
| public List Tries to parse all .java files under the source root recursively using multiple threads, and returns all files
ever parsed with this source root. A new thread is forked each time a new directory is visited and is responsible
for parsing all .java files in that directory. Note that to ensure thread safety, a new parser instance is
created for every file with the internal (i.e. | |
| Modifier and Type | Class and Description |
|---|---|
| public static enum |
| Modifier and Type | Method and Description |
|---|---|
| public SourceRoot. | process(Path
the path to the file that was parsed, relative to the source root path. localPath, Path the absolute path to the file that was parsed. absolutePath, ParseResult<CompilationUnit> the result of of parsing the file. result)
|
| process | back to summary |
|---|---|
public SourceRoot.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final SourceRoot. | |
| public static final SourceRoot. | |
| public static final SourceRoot. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static SourceRoot. | |
| public static SourceRoot. |
| DONT_SAVE | back to summary |
|---|---|
| public static final SourceRoot. | |
| SAVE | back to summary |
|---|---|
| public static final SourceRoot. | |
| TERMINATE | back to summary |
|---|---|
| public static final SourceRoot. | |
| Result | back to summary |
|---|---|
| private Result() | |
| valueOf | back to summary |
|---|---|
| public static SourceRoot. | |
| values | back to summary |
|---|---|
| public static SourceRoot. | |
VisitFileCallback is called with the current
path and file attributes. Any shared resources accessed in a VisitFileCallback should be made
thread-safe.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface |
| Modifier and Type | Field and Description |
|---|---|
| private final SourceRoot. | |
| private final Path | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | compute()
Implements abstract java. |
| callback | back to summary |
|---|---|
| private final SourceRoot. | |
| path | back to summary |
|---|---|
| private final Path path | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| ParallelParse | back to summary |
|---|---|
| pack-priv ParallelParse(Path path, SourceRoot. | |
| compute | back to summary |
|---|---|
| protected void compute() Implements abstract java. Doc from java. The main computation performed by this task.
| |
| Modifier and Type | Method and Description |
|---|---|
| public FileVisitResult |
| process | back to summary |
|---|---|
| public FileVisitResult process(Path file, BasicFileAttributes attrs) | |