org.sf.codejen
Class TemplateAdapter

java.lang.Object
  extended by org.sf.codejen.TemplateAdapter
All Implemented Interfaces:
Template
Direct Known Subclasses:
DefaultTemplate

public class TemplateAdapter
extends Object
implements Template

Null implementation of Template. All implementation of methods are empty or return null.

Author:
Shane Ng

Constructor Summary
TemplateAdapter()
           
 
Method Summary
 void addPostProcessor(TemplateProcessor processor)
          Adds the post processor of the source code.
 boolean apply(Object model)
          Applies the data model to the template.
 List<File> getGeneratedFileList()
          Gets a list of generated files for post processor to process.
 String getName()
          Gets the name of the template.
 boolean isUndoable()
          Indicates if undo is implemented.
 void setFileNameGenerator(FileNameGenerator generator)
          Sets the FileNameGenerator for generating file names for one-to-many code generation.
 void setModelExtractor(ModelExtractor extractor)
          Sets the ModelExtractor for one-to-many code generation.
 void undo()
          Undos the code generation. i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateAdapter

public TemplateAdapter()
Method Detail

apply

public boolean apply(Object model)
              throws TemplateException
Description copied from interface: Template
Applies the data model to the template.

Specified by:
apply in interface Template
Returns:
false when nothing can be generated; otherwise true.
Throws:
TemplateException - if any error is encoutered during the code generation. Code Generator should use Throwable.getCause() to access the wrapped exception.

getName

public String getName()
Description copied from interface: Template
Gets the name of the template.

Specified by:
getName in interface Template
Returns:
the name of the template.

addPostProcessor

public void addPostProcessor(TemplateProcessor processor)
Description copied from interface: Template
Adds the post processor of the source code.

Specified by:
addPostProcessor in interface Template
Parameters:
processor - processing the output.

undo

public void undo()
Description copied from interface: Template
Undos the code generation. i.e. Delete the generated files.

Specified by:
undo in interface Template

isUndoable

public boolean isUndoable()
Description copied from interface: Template
Indicates if undo is implemented.

Specified by:
isUndoable in interface Template
Returns:
true if the template is undoable; false, otherwise.

getGeneratedFileList

public List<File> getGeneratedFileList()
Description copied from interface: Template
Gets a list of generated files for post processor to process.

Specified by:
getGeneratedFileList in interface Template
Returns:
a list of generated files.

setModelExtractor

public void setModelExtractor(ModelExtractor extractor)
Description copied from interface: Template
Sets the ModelExtractor for one-to-many code generation.

Specified by:
setModelExtractor in interface Template
Parameters:
extractor - extractor to extract the model.

setFileNameGenerator

public void setFileNameGenerator(FileNameGenerator generator)
Description copied from interface: Template
Sets the FileNameGenerator for generating file names for one-to-many code generation.

Specified by:
setFileNameGenerator in interface Template
Parameters:
generator - the file name generator.