ch.sahits.codegen.java.generator.ast
Class ASTGenerator

java.lang.Object
  extended by ch.sahits.codegen.generator.AbstractGenerator
      extended by ch.sahits.codegen.java.generator.ast.ASTGenerator
All Implemented Interfaces:
IBaseGenerator, IGenerator

public final class ASTGenerator
extends AbstractGenerator
implements IGenerator

This generator generates the java file by generating the rump with JET. If no explicit JET template is supplied a generic JET file produces the rump.
To define another JET Generator class the method getJetGenerator() must be overridden.

Since:
0.9.0 TODO Replace IGeneratedJavaDBClass with IGeneratedJavaDBClass2
Author:
Andi Hotz

Field Summary
protected  AST ast
          Representation of the source-code to be generated as an abstract syntax tree.
static int AST_STATIC_WORKLOAD
          static estimation of the AST part of the work load
protected  boolean initialized
           
protected  CompilationUnit unit
          The compilation unit that will be generated
 
Constructor Summary
ASTGenerator()
          Default constructor
 
Method Summary
 void cleanup()
          Clean up the mess
 java.lang.String generate()
          Pass the generation to the specified generator class.
 int getWorkload()
          Take the workload for the generation of the JET file and add 3
 void init()
          Generate the basic class implementation with JET
 void init(IJetGatewayConfiguration config)
          Initialize the configuration
 boolean isInitialized()
          Check whether all members are initialized
 void setMonitor(IProgressMonitor _monitor)
          Set the monitor for the progress
 
Methods inherited from class ch.sahits.codegen.generator.AbstractGenerator
createIfNull, findOrCreateContainer, getConfig, save, setConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.sahits.codegen.generator.IGenerator
getConfig, save
 

Field Detail

AST_STATIC_WORKLOAD

public static final int AST_STATIC_WORKLOAD
static estimation of the AST part of the work load

See Also:
Constant Field Values

ast

protected AST ast
Representation of the source-code to be generated as an abstract syntax tree.


unit

protected CompilationUnit unit
The compilation unit that will be generated


initialized

protected boolean initialized
Constructor Detail

ASTGenerator

public ASTGenerator()
Default constructor

Method Detail

cleanup

public void cleanup()
             throws CoreException
Clean up the mess

Specified by:
cleanup in interface IGenerator
Throws:
CoreException

generate

public java.lang.String generate()
Pass the generation to the specified generator class.

Specified by:
generate in interface IBaseGenerator
Returns:
String representation of the generated code

getWorkload

public int getWorkload()
Take the workload for the generation of the JET file and add 3

Specified by:
getWorkload in interface IGenerator
Returns:
workload

init

public void init()
Generate the basic class implementation with JET

Specified by:
init in interface IGenerator

setMonitor

public void setMonitor(IProgressMonitor _monitor)
Description copied from interface: IGenerator
Set the monitor for the progress

Specified by:
setMonitor in interface IGenerator
Parameters:
_monitor -

isInitialized

public boolean isInitialized()
Check whether all members are initialized

Specified by:
isInitialized in interface IBaseGenerator
Returns:
true if the model and the baseClass are initialized

init

public void init(IJetGatewayConfiguration config)
Initialize the configuration

Specified by:
init in interface IBaseGenerator
Parameters:
config - Configuration