Package | Description |
---|---|
com.github.javaparser | |
com.github.javaparser.ast | |
com.github.javaparser.ast.visitor | |
com.github.javaparser.printer | |
com.github.javaparser.utils |
Modifier and Type | Field and Description |
---|---|
static ParseStart<CompilationUnit> |
ParseStart.COMPILATION_UNIT |
Modifier and Type | Method and Description |
---|---|
static CompilationUnit |
JavaParser.parse(File file)
Parses the Java code contained in a
File and returns a
CompilationUnit that represents it.Note: Uses UTF-8 encoding |
static CompilationUnit |
JavaParser.parse(File file,
Charset encoding)
Parses the Java code contained in a
File and returns a
CompilationUnit that represents it. |
static CompilationUnit |
JavaParser.parse(InputStream in)
Parses the Java code contained in the
InputStream and returns a
CompilationUnit that represents it.Note: Uses UTF-8 encoding |
static CompilationUnit |
JavaParser.parse(InputStream in,
Charset encoding)
Parses the Java code contained in the
InputStream and returns a
CompilationUnit that represents it. |
static CompilationUnit |
JavaParser.parse(Path path)
Parses the Java code contained in a file and returns a
CompilationUnit that represents it.Note: Uses UTF-8 encoding |
static CompilationUnit |
JavaParser.parse(Path path,
Charset encoding)
Parses the Java code contained in a file and returns a
CompilationUnit that represents it. |
static CompilationUnit |
JavaParser.parse(Reader reader)
Parses Java code from a Reader and returns a
CompilationUnit that represents it. |
static CompilationUnit |
JavaParser.parse(String code)
Parses the Java code contained in code and returns a
CompilationUnit that represents it. |
static CompilationUnit |
JavaParser.parseResource(ClassLoader classLoader,
String path,
Charset encoding)
Parses the Java code contained in a resource and returns a
CompilationUnit that represents it. |
static CompilationUnit |
JavaParser.parseResource(String path)
Parses the Java code contained in a resource and returns a
CompilationUnit that represents it.Note: Uses UTF-8 encoding |
static CompilationUnit |
JavaParser.parseResource(String path,
Charset encoding)
Parses the Java code contained in a resource and returns a
CompilationUnit that represents it. |
Modifier and Type | Method and Description |
---|---|
CompilationUnit |
CompilationUnit.addImport(Class<?> clazz)
Add an import to the list of
ImportDeclaration of this compilation unitshorthand for addImport(String) with clazz.getName() |
CompilationUnit |
CompilationUnit.addImport(ImportDeclaration imports) |
CompilationUnit |
CompilationUnit.addImport(String name)
Add an import to the list of
ImportDeclaration of this compilation unitshorthand for addImport(String, boolean, boolean) with name,false,false |
CompilationUnit |
CompilationUnit.addImport(String name,
boolean isStatic,
boolean isAsterisk)
Add an import to the list of
ImportDeclaration of this compilation unitThis method check if no import with the same name is already in the list |
CompilationUnit |
CompilationUnit.addType(TypeDeclaration<?> type) |
CompilationUnit |
CompilationUnit.clone() |
CompilationUnit |
CompilationUnit.Storage.getCompilationUnit() |
CompilationUnit |
CompilationUnit.removeModule() |
CompilationUnit |
CompilationUnit.removePackageDeclaration() |
CompilationUnit |
CompilationUnit.setImport(int i,
ImportDeclaration imports) |
CompilationUnit |
CompilationUnit.setImports(NodeList<ImportDeclaration> imports)
Sets the list of imports of this compilation unit.
|
CompilationUnit |
CompilationUnit.setModule(ModuleDeclaration module) |
CompilationUnit |
CompilationUnit.setPackageDeclaration(PackageDeclaration packageDeclaration)
Sets or clear the package declarations of this compilation unit.
|
CompilationUnit |
CompilationUnit.setPackageDeclaration(String name)
sets the package declaration of this compilation unit
|
CompilationUnit |
CompilationUnit.setStorage(Path path) |
CompilationUnit |
CompilationUnit.setType(int i,
TypeDeclaration<?> type) |
CompilationUnit |
CompilationUnit.setTypes(NodeList<TypeDeclaration<?>> types)
Sets the list of types declared in this compilation unit.
|
Modifier and Type | Method and Description |
---|---|
ParseResult<CompilationUnit> |
CompilationUnit.Storage.reparse(JavaParser javaParser) |
Modifier and Type | Method and Description |
---|---|
void |
CompilationUnit.Storage.save(Function<CompilationUnit,String> makeOutput)
Saves a compilation unit to its original location with formatting according to the function
passed as a parameter.
|
Modifier and Type | Method and Description |
---|---|
R |
GenericVisitor.visit(CompilationUnit n,
A arg) |
Visitable |
ModifierVisitor.visit(CompilationUnit n,
A arg) |
void |
VoidVisitor.visit(CompilationUnit n,
A arg) |
R |
GenericVisitorWithDefaults.visit(CompilationUnit n,
A arg) |
void |
VoidVisitorAdapter.visit(CompilationUnit n,
A arg) |
R |
GenericVisitorAdapter.visit(CompilationUnit n,
A arg) |
List<R> |
GenericListVisitorAdapter.visit(CompilationUnit n,
A arg) |
void |
VoidVisitorWithDefaults.visit(CompilationUnit n,
A arg) |
Visitable |
CloneVisitor.visit(CompilationUnit n,
Object arg) |
Boolean |
EqualsVisitor.visit(CompilationUnit n,
Visitable arg) |
Boolean |
ObjectIdentityEqualsVisitor.visit(CompilationUnit n,
Visitable arg) |
Integer |
ObjectIdentityHashCodeVisitor.visit(CompilationUnit n,
Void arg) |
Integer |
HashCodeVisitor.visit(CompilationUnit n,
Void arg) |
Modifier and Type | Method and Description |
---|---|
void |
PrettyPrintVisitor.visit(CompilationUnit n,
Void arg) |
Modifier and Type | Method and Description |
---|---|
CompilationUnit |
SourceRoot.parse(String pkg,
String filename)
Parses a .java files under the source root and returns its CompilationUnit.
|
Modifier and Type | Method and Description |
---|---|
List<ParseResult<CompilationUnit>> |
SourceRoot.getCache()
The Java files that have been parsed by this source root object,
or have been added manually.
|
List<CompilationUnit> |
SourceRoot.getCompilationUnits()
The CompilationUnits of the Java files that have been parsed succesfully by this source root object,
or have been added manually.
|
Function<CompilationUnit,String> |
SourceRoot.getPrinter()
Get the printing function.
|
List<Pair<Path,ParseResult<CompilationUnit>>> |
SourceZip.parse()
Tries to parse all '.java' files in the ZIP located at this SourceZip's path and returns the parse
results in a list.
|
List<ParseResult<CompilationUnit>> |
SourceRoot.tryToParse()
Tries to parse all .java files under the source root recursively, and returns all files ever parsed with this
source root.
|
List<ParseResult<CompilationUnit>> |
SourceRoot.tryToParse(String startPackage)
Tries to parse all .java files in a package recursively, and returns all files ever parsed with this source
root.
|
ParseResult<CompilationUnit> |
SourceRoot.tryToParse(String pkg,
String filename)
Tries to parse a .java files under the source root and returns the ParseResult.
|
ParseResult<CompilationUnit> |
SourceRoot.tryToParse(String pkg,
String filename,
JavaParser javaParser)
Tries to parse a .java files under the source root and returns the ParseResult.
|
List<ParseResult<CompilationUnit>> |
SourceRoot.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.
|
List<ParseResult<CompilationUnit>> |
SourceRoot.tryToParseParallelized(String startPackage)
Tries to parse all .java files in a package recursively using multiple threads, and returns all files ever
parsed with this source root.
|
Modifier and Type | Method and Description |
---|---|
SourceRoot |
SourceRoot.add(CompilationUnit compilationUnit)
Add a newly created Java file to the cache of this source root.
|
SourceRoot |
SourceRoot.add(String pkg,
String filename,
CompilationUnit compilationUnit)
Add a newly created Java file to the cache of this source root.
|
Modifier and Type | Method and Description |
---|---|
void |
SourceZip.Callback.process(Path relativeZipEntryPath,
ParseResult<CompilationUnit> result)
Process the given parse result.
|
SourceRoot.Callback.Result |
SourceRoot.Callback.process(Path localPath,
Path absolutePath,
ParseResult<CompilationUnit> result) |
SourceRoot |
SourceRoot.setPrinter(Function<CompilationUnit,String> printer)
Set the printing function that transforms compilation units into a string to save.
|
Copyright © 2007–2017. All rights reserved.