org.sf.codejen
Class CodeGenerator

java.lang.Object
  extended by org.sf.codejen.CodeGenerator
All Implemented Interfaces:
Runnable

public class CodeGenerator
extends Object
implements Runnable

Code generator

Author:
Shane Ng

Constructor Summary
CodeGenerator()
           
CodeGenerator(List<Template> config)
          Constructs the code generator with a list of templates.
CodeGenerator(String fileName)
          Constructs the code generator with the filename of the configuration.
 
Method Summary
 List<Throwable> getErrors()
          Returns the error during the code generation.
 void parseConfiguration(String fileName)
          Parses the codegen config.
 void resetConfiguration()
          Clears the codegen config.
 void run()
          Runs the code generation process.
 void setModel(Object model)
          Sets the data model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeGenerator

public CodeGenerator()

CodeGenerator

public CodeGenerator(String fileName)
              throws IOException,
                     SAXException
Constructs the code generator with the filename of the configuration.

Parameters:
fileName - the file name of codegen config.
Throws:
IOException - when error is encounter in file reading
SAXException - when error is encounter in config parsing

CodeGenerator

public CodeGenerator(List<Template> config)
Constructs the code generator with a list of templates.

Parameters:
config -
Method Detail

run

public void run()
Runs the code generation process. Before invoking this method:

parseConfiguration

public void parseConfiguration(String fileName)
                        throws IOException,
                               SAXException
Parses the codegen config.

Parameters:
fileName - the file name of the codegen config.
Throws:
IOException - when error is encounter in file reading
SAXException - when error is encounter in config parsing

setModel

public void setModel(Object model)
Sets the data model.

Parameters:
model - the data model to be used.

getErrors

public List<Throwable> getErrors()
Returns the error during the code generation.

Returns:
a list of Throwable in unmodifiable list.

resetConfiguration

public void resetConfiguration()
Clears the codegen config.