org.objectweb.speedo.generation.generator.lib
Class AbstractVelocityGenerator
java.lang.Object
org.objectweb.speedo.generation.lib.AbstractGeneratorComponent
org.objectweb.speedo.generation.generator.lib.AbstractVelocityGenerator
- All Implemented Interfaces:
- GeneratorComponent, VelocityGenerator
- Direct Known Subclasses:
- ObjectIdGenerator, SpeedoGenerator
- public abstract class AbstractVelocityGenerator
- extends AbstractGeneratorComponent
- implements VelocityGenerator
- Author:
- S.Chassande-Barrioz
Field Summary |
protected static char |
fs
|
protected org.apache.velocity.Template |
template
|
static java.lang.String |
TEMPLATE_DIR
|
protected org.apache.velocity.app.VelocityEngine |
ve
|
Method Summary |
protected void |
computeTemplate(java.lang.String templateFN)
|
abstract void |
generate(SpeedoClass sClass,
java.lang.String fileName)
generate the file name corresponding to the Speedo meta object given in
parameter. |
java.util.Collection |
getExternalsTemplate()
|
org.apache.velocity.app.VelocityEngine |
getVelocityEngine()
|
abstract boolean |
init()
|
protected static boolean |
isClassicalType(java.lang.String type)
This method indicates if the type is a boolean, a char, a short, an int,
a long, a float, a double or a String. |
boolean |
isContainerIdField(org.objectweb.jorm.metainfo.api.Class clazz,
org.objectweb.jorm.metainfo.api.TypedElement te,
SpeedoClass sc)
|
void |
process()
|
void |
setVelocityEngine(org.apache.velocity.app.VelocityEngine ve)
It assignes the VelocityEngine instance which must be used during the
veleocity generatioin. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEMPLATE_DIR
public static final java.lang.String TEMPLATE_DIR
- See Also:
- Constant Field Values
ve
protected org.apache.velocity.app.VelocityEngine ve
fs
protected static char fs
template
protected org.apache.velocity.Template template
AbstractVelocityGenerator
public AbstractVelocityGenerator()
computeTemplate
protected void computeTemplate(java.lang.String templateFN)
throws SpeedoException
- Throws:
SpeedoException
isClassicalType
protected static boolean isClassicalType(java.lang.String type)
- This method indicates if the type is a boolean, a char, a short, an int,
a long, a float, a double or a String.
- Parameters:
type
- the type to determine.
- Returns:
- true if the String is one of those above.
isContainerIdField
public boolean isContainerIdField(org.objectweb.jorm.metainfo.api.Class clazz,
org.objectweb.jorm.metainfo.api.TypedElement te,
SpeedoClass sc)
getVelocityEngine
public org.apache.velocity.app.VelocityEngine getVelocityEngine()
- Specified by:
getVelocityEngine
in interface VelocityGenerator
- Returns:
- the VelocityEngine used during the velocity generation.
setVelocityEngine
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine ve)
- Description copied from interface:
VelocityGenerator
- It assignes the VelocityEngine instance which must be used during the
veleocity generatioin.
- Specified by:
setVelocityEngine
in interface VelocityGenerator
- Parameters:
ve
- is the VelocityEngine instance to use.
getExternalsTemplate
public java.util.Collection getExternalsTemplate()
- Specified by:
getExternalsTemplate
in interface VelocityGenerator
- 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 abstract void generate(SpeedoClass sClass,
java.lang.String fileName)
throws SpeedoException
- generate the file name corresponding to the Speedo meta object given in
parameter.
- Specified by:
generate
in interface VelocityGenerator
- Parameters:
sClass
- is the speedo meta object which represents a persistent classfileName
- is the generated file name
- Throws:
SpeedoException
init
public abstract boolean init()
throws SpeedoException
- Specified by:
init
in interface GeneratorComponent
- Specified by:
init
in class AbstractGeneratorComponent
- Throws:
SpeedoException
process
public final void process()
throws SpeedoException
- Specified by:
process
in interface GeneratorComponent
- Specified by:
process
in class AbstractGeneratorComponent
- Throws:
SpeedoException