public interface CompilationUnit extends Codeable
Declaration
subinterface for compilation units. A compilation unit is
the source code atom in a typical filesystem. It consists of three parts,
each of which is optional:
Modifier and Type | Method and Description |
---|---|
Import |
addImport(Class<?> clazz)
Adds the given import declaration to the compilation unit.
|
Import |
addImport(String name)
Adds the given import declaration to the compilation unit.
|
CompilationUnit |
encode()
Generates the source code file.
|
String |
getCodebase()
Returns the filesystem location where the compilation unit should be
written.
|
List<Import> |
getImports()
Gets the list of imports as an list of
ImportDeclaration |
Namespace |
getNamespace()
Returns the package name as a
Package . |
PackageClass |
getPackageClass(String name) |
TypeDeclaration |
getTopLevelType()
Gets the top level class or interface.
|
List<TypeDeclaration> |
getTypes()
Returns a list of types members as an list of
TypeDeclaration . |
PackageClass |
newClass(String name)
Adds a new class to this compilation unit.
|
Interface |
newInterface(String name)
Adds a new interface to this compilation unit.
|
PackageClass |
newPublicClass(String name)
Adds a new public class to this compilation unit.
|
Interface |
newPublicInterface(String name)
Adds a new interface to this compilation unit.
|
Namespace |
setNamespace(String name)
Sets the package name and returns the corresponding package declaration.
|
applyStyle, cast, getComment, isActive, isBlockWithAbruptCompletion, setComment, toCode, visit, vm
Import addImport(Class<?> clazz)
CompilationUnit encode()
String getCodebase()
Namespace getNamespace()
Package
.PackageClass getPackageClass(String name)
TypeDeclaration getTopLevelType()
List<TypeDeclaration> getTypes()
TypeDeclaration
.PackageClass newClass(String name)
PackageClass newPublicClass(String name)
Interface newPublicInterface(String name)
Copyright © 2000–2018 jenesis4java. All rights reserved.