ch.sahits.codegen.java.generator.jettemplate
Class AbstractJETTemplateGenerator

java.lang.Object
  extended by ch.sahits.codegen.generator.AbstractGenerator
      extended by ch.sahits.codegen.generator.JETGateway
          extended by ch.sahits.codegen.java.generator.jettemplate.AbstractJETTemplateGenerator
All Implemented Interfaces:
IBaseGenerator, IGenerator
Direct Known Subclasses:
AbstractJETASTGenerator, InitializableDbBeanGenerator

public abstract class AbstractJETTemplateGenerator
extends JETGateway

This class provides common method to create a JET template file

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

Field Summary
protected  java.io.File jetTemplateFile
          This file is the handle to the jet-template
 
Constructor Summary
AbstractJETTemplateGenerator()
          Constructor that passes the call to the super class JETGateway
 
Method Summary
protected  void addImport(java.lang.String imp)
          Add an import directive to the list
protected abstract  void addImports()
          // * Add all imports
protected  void addJetPluginID2Builder(IConfigurationBuilder builder, java.lang.String jetTempPath)
          Add the jetemplate plugin id to the builder
protected  void append(java.lang.String s)
          Append a string to the jetemplate
protected  void appendLn(java.lang.String line)
          Append a string to the jetemplate and add a line break
 void cleanup()
          Execute the cleanup defined in the super class.
 java.lang.String generate(IProgressMonitor monitor)
          This generation method creates a jetemplate and then calls onto the generation of the super class
protected abstract  void generateTemplate()
          Create the template file
 void init(IJetGatewayConfiguration config)
          Initialize the configuration and generator
protected  void writeDirective()
          Write the jet directive as the first line of the jetemplate.
 
Methods inherited from class ch.sahits.codegen.generator.JETGateway
generate, getJETEmitter, getWorkload, init, isInitialized, setMonitor
 
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

jetTemplateFile

protected java.io.File jetTemplateFile
This file is the handle to the jet-template

Constructor Detail

AbstractJETTemplateGenerator

public AbstractJETTemplateGenerator()
Constructor that passes the call to the super class JETGateway

Method Detail

init

public void init(IJetGatewayConfiguration config)
Initialize the configuration and generator

Specified by:
init in interface IBaseGenerator
Overrides:
init in class JETGateway

cleanup

public void cleanup()
             throws CoreException
Execute the cleanup defined in the super class. Then delete the temporary file.

Specified by:
cleanup in interface IGenerator
Overrides:
cleanup in class JETGateway
Throws:
CoreException
See Also:
JETGateway.cleanup()

addImport

protected final void addImport(java.lang.String imp)
Add an import directive to the list

Parameters:
imp - class or package to be imported

appendLn

protected final void appendLn(java.lang.String line)
Append a string to the jetemplate and add a line break

Parameters:
line - contents of the line.

append

protected final void append(java.lang.String s)
Append a string to the jetemplate

Parameters:
s - string to be appended

writeDirective

protected final void writeDirective()
Write the jet directive as the first line of the jetemplate. This can be done at any time of the creation process.


addImports

protected abstract void addImports()
// * Add all imports


generateTemplate

protected abstract void generateTemplate()
Create the template file


generate

public java.lang.String generate(IProgressMonitor monitor)
                          throws CoreException
This generation method creates a jetemplate and then calls onto the generation of the super class

Overrides:
generate in class JETGateway
Parameters:
monitor - the progress monitor to use. May be null.
Returns:
the source code text generated by the JET template
Throws:
CoreException
See Also:
ch.sahits.codegen.generator.JETGateway#generate(org.eclipse.core.runtime.IProgressMonitor)

addJetPluginID2Builder

protected final void addJetPluginID2Builder(IConfigurationBuilder builder,
                                            java.lang.String jetTempPath)
Add the jetemplate plugin id to the builder

Parameters:
builder - Configuration builder
jetTempPath - template pathe of the jetemplate
Since:
2.1.0