public static final class Java.CompilationUnit extends Java.AbstractCompilationUnit
Java.AbstractCompilationUnit.ImportDeclaration, Java.AbstractCompilationUnit.SingleStaticImportDeclaration, Java.AbstractCompilationUnit.SingleTypeImportDeclaration, Java.AbstractCompilationUnit.StaticImportOnDemandDeclaration, Java.AbstractCompilationUnit.TypeImportOnDemandDeclaration| Modifier and Type | Field and Description |
|---|---|
Java.PackageDeclaration |
packageDeclaration
The package declaration at the very top of this compilation unit (if any).
|
List<Java.PackageMemberTypeDeclaration> |
packageMemberTypeDeclarations
The top-level declarations in this compilation unit.
|
fileName, importDeclarations| Constructor and Description |
|---|
CompilationUnit(String fileName) |
CompilationUnit(String fileName,
Java.AbstractCompilationUnit.ImportDeclaration[] importDeclarations) |
| Modifier and Type | Method and Description |
|---|---|
<R,EX extends Throwable> |
accept(Visitor.AbstractCompilationUnitVisitor<R,EX> visitor)
Invokes the "
visit...()" method of Visitor.AbstractCompilationUnitVisitor for the concrete
Java.AbstractCompilationUnit type. |
void |
addPackageMemberTypeDeclaration(Java.PackageMemberTypeDeclaration pmtd)
Adds one top-level type declaration to this compilation unit.
|
Java.PackageMemberTypeDeclaration |
getPackageMemberTypeDeclaration(String name)
Returns 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 compilation unit.
|
getEnclosingScope@Nullable public Java.PackageDeclaration packageDeclaration
public final List<Java.PackageMemberTypeDeclaration> packageMemberTypeDeclarations
public CompilationUnit(@Nullable String fileName, Java.AbstractCompilationUnit.ImportDeclaration[] importDeclarations)
public void setPackageDeclaration(@Nullable Java.PackageDeclaration packageDeclaration)
public void addPackageMemberTypeDeclaration(Java.PackageMemberTypeDeclaration pmtd)
public Java.PackageMemberTypeDeclaration[] getPackageMemberTypeDeclarations()
@Nullable 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 unit@Nullable public <R,EX extends Throwable> R accept(Visitor.AbstractCompilationUnitVisitor<R,EX> visitor) throws EX extends Throwable
Java.AbstractCompilationUnitvisit...()" method of Visitor.AbstractCompilationUnitVisitor for the concrete
Java.AbstractCompilationUnit type.accept in class Java.AbstractCompilationUnitEX extends ThrowableCopyright © 2022. All rights reserved.