org.inxar.jenesis
Interface CompilationUnit

All Superinterfaces:
Codeable

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:


Method Summary
 Import addImport(java.lang.String name)
          Adds the given import declaration to the compilation unit.
 boolean compile()
          Generates the source code file and compiles it.
 void encode()
          Generates the source code file.
 java.lang.String getCodebase()
          Returns the filesystem location where the compilation unit should be written.
 Iterator getImports()
          Gets the list of imports as an iterator of ImportDeclaration
 Namespace getNamespace()
          Returns the package name as a Package.
 TypeDeclaration getTopLevelType()
          Gets the top level class or interface.
 Iterator getTypes()
          Returns a list of types members as an iterator of TypeDeclaration.
 PackageClass newClass(java.lang.String name)
          Adds a new class to this compilation unit.
 Interface newInterface(java.lang.String name)
          Adds a new interface to this compilation unit.
 Namespace setNamespace(java.lang.String name)
          Sets the package name and returns the corresponding package declaration.
 
Methods inherited from interface org.inxar.jenesis.Codeable
getComment, setComment, toCode, vm
 

Method Detail

encode

public void encode()
            throws java.io.IOException
Generates the source code file.

compile

public boolean compile()
                throws java.io.IOException
Generates the source code file and compiles it.

getNamespace

public Namespace getNamespace()
Returns the package name as a Package.

getCodebase

public java.lang.String getCodebase()
Returns the filesystem location where the compilation unit should be written.

setNamespace

public Namespace setNamespace(java.lang.String name)
Sets the package name and returns the corresponding package declaration.

getImports

public Iterator getImports()
Gets the list of imports as an iterator of ImportDeclaration

addImport

public Import addImport(java.lang.String name)
Adds the given import declaration to the compilation unit.

getTopLevelType

public TypeDeclaration getTopLevelType()
Gets the top level class or interface.

newClass

public PackageClass newClass(java.lang.String name)
Adds a new class to this compilation unit.

newInterface

public Interface newInterface(java.lang.String name)
Adds a new interface to this compilation unit.

getTypes

public Iterator getTypes()
Returns a list of types members as an iterator of TypeDeclaration.