org.objectweb.speedo.generation.generator.api
Interface VelocityGenerator

All Superinterfaces:
GeneratorComponent
All Known Implementing Classes:
AbstractVelocityGenerator

public interface VelocityGenerator
extends GeneratorComponent

This interface represents a component of a generator which generates a file with the Velocity tool. The use of this interface permits to reuse the VelocityEngine in order have better generation performance. Indeed the VelocityEngine initialization is very cheap.

Author:
S.Chassande-Barrioz

Method Summary
 void generate(SpeedoClass sClass, java.lang.String fileName)
          It generates the file name corresponding to the Speedo meta object given in parameter.
 java.util.Collection getExternalsTemplate()
           
 org.apache.velocity.app.VelocityEngine getVelocityEngine()
           
 void setVelocityEngine(org.apache.velocity.app.VelocityEngine ve)
          It assignes the VelocityEngine instance which must be used during the veleocity generatioin.
 
Methods inherited from interface org.objectweb.speedo.generation.api.GeneratorComponent
getSpeedoCompilerParameter, init, process, setSpeedoCompilerParameter
 

Method Detail

setVelocityEngine

public void setVelocityEngine(org.apache.velocity.app.VelocityEngine ve)
It assignes the VelocityEngine instance which must be used during the veleocity generatioin.

Parameters:
ve - is the VelocityEngine instance to use.

getVelocityEngine

public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Returns:
the VelocityEngine used during the velocity generation.

getExternalsTemplate

public java.util.Collection getExternalsTemplate()
Returns:
a collection of the file names which contains macros. This file name list will be given to the VelocityEngine during its initialization.

generate

public void generate(SpeedoClass sClass,
                     java.lang.String fileName)
              throws SpeedoException
It generates the file name corresponding to the Speedo meta object given in parameter.

Parameters:
sClass - is the speedo meta object which represents a persistent class
fileName - is the generated file name
Throws:
SpeedoException