vdoclet
Class Generator

java.lang.Object
  |
  +--vdoclet.Generator

public class Generator
extends Object

A file-generator using Velocity


Constructor Summary
Generator(File outputDir)
          Construct a new generator.
Generator(File outputDir, ClassLoader templateClassLoader)
          Construct a new generator.
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Generator

public Generator(File outputDir,
                 ClassLoader templateClassLoader)
          throws GeneratorException
Construct a new generator.

Parameters:
outputDir - base-directory for output
templateClassLoader - class-loader used to find templates

Generator

public Generator(File outputDir)
          throws GeneratorException
Construct a new generator.

Parameters:
outputDir - base-directory for output
Method Detail

getEngine

protected org.apache.velocity.app.VelocityEngine getEngine()
Get the VelocityEngine used by this generator


getOutputDir

public File getOutputDir()
Get the output directory


getFileWriter

protected FileWriter getFileWriter(String fileName)
                            throws IOException
Get a Writer to the specified File

IOException

getContext

public org.apache.velocity.context.Context getContext()
Get the evaluation-context used by this generator


setAttribute

public void setAttribute(String key,
                         Object value)
Add something to the Generator's evaluation-context


eval

public void eval(String templateName,
                 Writer writer)
          throws IOException,
                 GeneratorException
Evaluate a Velocity template.

Parameters:
templateName - name of the template
writer - output destination
IOException
GeneratorException

eval

public void eval(String templateName,
                 String fileName)
          throws IOException,
                 GeneratorException
Evaluate a Velocity template.

Parameters:
templateName - name of the template
fileName - name of output file
IOException
GeneratorException

makeBean

public Object makeBean(String className)
                throws Exception
Create an instance of the named class.

Parameters:
className - the name of the class to instantiate
Exception