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:
- FieldsGenerator, ObjectIdGenerator, ProxyGenerator
- public abstract class AbstractVelocityGenerator
- extends AbstractGeneratorComponent
- implements VelocityGenerator
- Author:
- S.Chassande-Barrioz
Field Summary |
protected static char |
fs
|
static java.lang.String |
TEMPLATE_DIR
|
protected java.lang.String |
templateFN
|
protected org.apache.velocity.app.VelocityEngine |
ve
|
Method Summary |
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 void |
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
ve
protected org.apache.velocity.app.VelocityEngine ve
fs
protected static char fs
templateFN
protected java.lang.String templateFN
AbstractVelocityGenerator
public AbstractVelocityGenerator()
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
- Following copied from interface:
org.objectweb.speedo.generation.generator.api.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
- Following copied from interface:
org.objectweb.speedo.generation.generator.api.VelocityGenerator
- Parameters:
ve
- is the VelocityEngine instance to use.
getExternalsTemplate
public java.util.Collection getExternalsTemplate()
- Specified by:
getExternalsTemplate
in interface VelocityGenerator
- Following copied from interface:
org.objectweb.speedo.generation.generator.api.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 void init()
throws SpeedoException
- Specified by:
init
in interface GeneratorComponent
- Overrides:
init
in class AbstractGeneratorComponent
process
public final void process()
throws SpeedoException
- Specified by:
process
in interface GeneratorComponent
- Overrides:
process
in class AbstractGeneratorComponent