Package | Description |
---|---|
com.github.javaparser | |
com.github.javaparser.ast | |
com.github.javaparser.ast.imports |
Modifier and Type | Field and Description |
---|---|
static ParseStart<ImportDeclaration> |
ParseStart.IMPORT_DECLARATION |
Modifier and Type | Method and Description |
---|---|
static ImportDeclaration |
JavaParser.parseImport(String importDeclaration)
Parses the Java import contained in a
String and returns a
ImportDeclaration that represents it. |
Modifier and Type | Method and Description |
---|---|
List<ImportDeclaration> |
CompilationUnit.getImports()
Retrieves the list of imports declared in this compilation unit or
null if there is no import. |
Modifier and Type | Method and Description |
---|---|
CompilationUnit |
CompilationUnit.setImports(List<ImportDeclaration> imports)
Sets the list of imports of this compilation unit.
|
Constructor and Description |
---|
CompilationUnit(PackageDeclaration pakage,
List<ImportDeclaration> imports,
List<TypeDeclaration<?>> types) |
CompilationUnit(Range range,
PackageDeclaration pakage,
List<ImportDeclaration> imports,
List<TypeDeclaration<?>> types) |
Modifier and Type | Class and Description |
---|---|
class |
EmptyImportDeclaration
A stray semicolon between the imports.
|
class |
SingleStaticImportDeclaration
Example:
import static com.github.javaparser.JavaParser.parse;
In the example, "com.github.javaparser.JavaParser" is the type,
and "parse" is the staticMember. |
class |
SingleTypeImportDeclaration
Example:
import com.github.javaparser.JavaParser; |
class |
StaticImportOnDemandDeclaration
Example:
import static com.github.javaparser.JavaParser.*; |
class |
TypeImportOnDemandDeclaration
Examples:
import com.github.javaparser.*;
import com.github.javaparser.JavaParser.*;
Since a parser cannot differentiate between a type name and a package name, we simply store a NameExpr. |
Modifier and Type | Method and Description |
---|---|
static ImportDeclaration |
ImportDeclaration.create(Range range,
NameExpr name,
boolean isStatic,
boolean isAsterisk)
Factory method for import declarations.
|
ImportDeclaration |
TypeImportOnDemandDeclaration.setName(NameExpr name)
Sets the name this import.
|
Copyright © 2007–2016. All rights reserved.