org.sourceforge.ifx.tools
Class VelocityWriter

java.lang.Object
  extended byorg.sourceforge.ifx.tools.VelocityWriter

public class VelocityWriter
extends java.lang.Object

Uses Velocity templates in the conf/ subdirectory to build Java source files from populated beans. Used by the CodeGenerator tool and the LegacyAdapterGenerator tools.

Version:
$Revision: 1.1 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Constructor Summary
VelocityWriter()
          Builds a default VelocityWriter object.
 
Method Summary
 java.lang.String getBaseDir()
          Return the base directory for this object.
 java.lang.String getSuffix()
          Return the suffix for the generated file.
 java.lang.String getTemplateDir()
          Returns the template directory for this object.
 void setBaseDir(java.lang.String basedir)
          Set the base directory for this object.
 void setSuffix(java.lang.String suffix)
          Set the suffix for the generated file.
 void setTemplateDir(java.lang.String templateDir)
          Set the template directory for this object.
 void write(java.lang.String generatedBeanFqcn, java.lang.Object templateBean)
          Instantiates a Velocity engine to write the bean to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocityWriter

public VelocityWriter()
Builds a default VelocityWriter object. Override the defaults with appropriate setXXX() calls.

Method Detail

getTemplateDir

public java.lang.String getTemplateDir()
Returns the template directory for this object.

Returns:
the template directory.

setTemplateDir

public void setTemplateDir(java.lang.String templateDir)
Set the template directory for this object.

Parameters:
templateDir - the template directory to set.

getBaseDir

public java.lang.String getBaseDir()
Return the base directory for this object.

Returns:
the base directory.

setBaseDir

public void setBaseDir(java.lang.String basedir)
Set the base directory for this object.

Parameters:
basedir - the base directory to set.

getSuffix

public java.lang.String getSuffix()
Return the suffix for the generated file.

Returns:
the generated file suffix.

setSuffix

public void setSuffix(java.lang.String suffix)
Set the suffix for the generated file.

Parameters:
suffix - the generated file suffix to set.

write

public void write(java.lang.String generatedBeanFqcn,
                  java.lang.Object templateBean)
           throws java.lang.Exception
Instantiates a Velocity engine to write the bean to a file.

Parameters:
generatedBeanFqcn - the fully qualified class name of the bean to be generated.
templateBean - the bean containing values to be fed to the template.
Throws:
java.lang.Exception - if any was thrown.