org.sf.codejen.freemarker
Class FreeMarkerTemplate
java.lang.Object
org.sf.codejen.TemplateAdapter
org.sf.codejen.DefaultTemplate
org.sf.codejen.freemarker.FreeMarkerTemplate
- All Implemented Interfaces:
- Template
public class FreeMarkerTemplate
- extends DefaultTemplate
Implementation of Template using FreeMarker as the template engine.
Complusory attributes:
- templateFile; will return
false if empty
- outputFile; if
modelExtractor does not exist and
outputFile is empty, no file will be generated.
Optional attributes:
- templateDir, default=working directory
- outputDir, default=working directory
- modelName, default=model
- canOverwrite, default=true
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FreeMarkerTemplate
public FreeMarkerTemplate()
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- Overrides:
apply in class TemplateAdapter
- 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.
setTemplateFile
public void setTemplateFile(String file)
setTemplateDir
public void setTemplateDir(String dir)
setModelName
public void setModelName(String modelName)
setOutputDir
public void setOutputDir(String outputDir)
setOutputFile
public void setOutputFile(String outputFile)
setCanOverwrite
public void setCanOverwrite(boolean canOverwrite)