public class Generator extends Object
Constructor and Description |
---|
Generator(File outputDir)
Construct a new generator.
|
Generator(File outputDir,
ClassLoader templateClassLoader)
Construct a new generator.
|
Modifier and Type | Method and Description |
---|---|
void |
eval(String templateName,
String fileName)
Evaluate a Velocity template.
|
void |
eval(String templateName,
Writer writer)
Evaluate a Velocity template.
|
org.apache.velocity.context.Context |
getContext()
Get the evaluation-context used by this generator
|
protected org.apache.velocity.app.VelocityEngine |
getEngine()
Get the VelocityEngine used by this generator
|
protected FileWriter |
getFileWriter(String fileName)
Get a Writer to the specified File
|
File |
getOutputDir()
Get the output directory
|
Object |
makeBean(String className)
Create an instance of the named class.
|
void |
setAttribute(String key,
Object value)
Add something to the Generator's evaluation-context
|
public Generator(File outputDir, ClassLoader templateClassLoader) throws GeneratorException
outputDir
- base-directory for outputtemplateClassLoader
- class-loader used to find templatesGeneratorException
public Generator(File outputDir) throws GeneratorException
outputDir
- base-directory for outputGeneratorException
protected org.apache.velocity.app.VelocityEngine getEngine()
public File getOutputDir()
protected FileWriter getFileWriter(String fileName) throws IOException
fileName
- a FileIOException
public org.apache.velocity.context.Context getContext()
public void setAttribute(String key, Object value)
public void eval(String templateName, Writer writer) throws IOException, GeneratorException
templateName
- name of the templatewriter
- output destinationIOException
GeneratorException
public void eval(String templateName, String fileName) throws IOException, GeneratorException
templateName
- name of the templatefileName
- name of output fileIOException
GeneratorException