public static final class Java.CompilationUnit extends Object implements Java.Scope
Parser.parseCompilationUnit()
.Modifier and Type | Class and Description |
---|---|
static class |
Java.CompilationUnit.ImportDeclaration
Base class for the various IMPORT declarations.
|
static class |
Java.CompilationUnit.SingleStaticImportDeclaration
Represents a single static import declaration like
|
static class |
Java.CompilationUnit.SingleTypeImportDeclaration
Represents a 'single-type import declaration' like '
import java.util.Map; '. |
static class |
Java.CompilationUnit.StaticImportOnDemandDeclaration
Represents a static-import-on-demand declaration like
|
static class |
Java.CompilationUnit.TypeImportOnDemandDeclaration
Represents a type-import-on-demand declaration like
import java.util.*; . |
Modifier and Type | Field and Description |
---|---|
List<Java.CompilationUnit.ImportDeclaration> |
importDeclarations
The IMPORT declarations in this CU.
|
String |
optionalFileName
A string that explains the 'file' (or similar resource) where this CU was loaded from.
|
Java.PackageDeclaration |
optionalPackageDeclaration
The package declaration at the very top of this CU (if any).
|
List<Java.PackageMemberTypeDeclaration> |
packageMemberTypeDeclarations
The top-level declarations in this CU.
|
Constructor and Description |
---|
CompilationUnit(String optionalFileName) |
Modifier and Type | Method and Description |
---|---|
void |
addImportDeclaration(Java.CompilationUnit.ImportDeclaration id)
Adds one IMPORT declaration to this CU.
|
void |
addPackageMemberTypeDeclaration(Java.PackageMemberTypeDeclaration pmtd)
Adds one top-level type declaration to this CU.
|
Java.Scope |
getEnclosingScope() |
Java.PackageMemberTypeDeclaration |
getPackageMemberTypeDeclaration(String name)
Return the package member class or interface declared with the given name.
|
Java.PackageMemberTypeDeclaration[] |
getPackageMemberTypeDeclarations()
Gets all classes and interfaces declared in this compilation unit.
|
void |
setPackageDeclaration(Java.PackageDeclaration packageDeclaration)
Sets the package declaration of this CU.
|
public final String optionalFileName
public Java.PackageDeclaration optionalPackageDeclaration
public final List<Java.CompilationUnit.ImportDeclaration> importDeclarations
public final List<Java.PackageMemberTypeDeclaration> packageMemberTypeDeclarations
public CompilationUnit(String optionalFileName)
public Java.Scope getEnclosingScope()
getEnclosingScope
in interface Java.Scope
null
public void setPackageDeclaration(Java.PackageDeclaration packageDeclaration)
public void addImportDeclaration(Java.CompilationUnit.ImportDeclaration id)
public void addPackageMemberTypeDeclaration(Java.PackageMemberTypeDeclaration pmtd)
public Java.PackageMemberTypeDeclaration[] getPackageMemberTypeDeclarations()
public Java.PackageMemberTypeDeclaration getPackageMemberTypeDeclaration(String name)
name
- Declared (i.e. not the fully qualified) namenull
if a package member type with that name is not declared in this compilation unitCopyright © 2001–2016. All rights reserved.