|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xcodegen.generator.AbstractCodeGenerator
Abstract implementation of CodeGenerator
Field Summary |
Fields inherited from interface xcodegen.generator.CodeGenerator |
CONFIG_CLASS_OUTPUT_DIR, CONFIG_CLASS_PREFIX, CONFIG_CLASS_SUFFIX, CONFIG_DATABASE, CONFIG_DATABASE_OUTPUT_DIR, CONFIG_DATABASE_OUTPUT_FILE, CONFIG_DATABASE_STRING_SIZE, CONFIG_LANGUAGE, CONFIG_PACKAGE_SUFFIX |
Constructor Summary | |
AbstractCodeGenerator(java.lang.String name)
Constructor |
Method Summary | |
protected abstract void |
generate(XClass clazz,
org.apache.velocity.VelocityContext context,
org.apache.velocity.Template template)
Generate the code of a class |
void |
generate(XPackage[] packages)
Generate to code of a set of packages |
protected abstract void |
generate(XPackage pkg,
org.apache.velocity.VelocityContext context,
org.apache.velocity.Template template)
Generate the code of a package |
java.lang.String |
getConfigProperty(java.lang.String name,
java.lang.String defaultValue)
Return a configuration property of the code generator |
org.apache.log4j.Logger |
getLogger()
Return the Logger |
java.lang.String |
getName()
Return the name of the CodeGenerator |
org.apache.velocity.VelocityContext |
getVelocityContext()
Return the VelocityContext used for generating the code |
org.apache.velocity.Template |
getVelocityTemplate()
Return the Velocity template |
abstract java.lang.String |
getVelocityTemplatePath()
Return the path the the template |
void |
init(java.util.Properties config)
Initialize the code generator |
protected java.util.Properties |
loadResourceAsProperties(java.lang.String path)
Create a java.util.Properties from a resource stream |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractCodeGenerator(java.lang.String name)
Method Detail |
public org.apache.log4j.Logger getLogger()
public java.lang.String getName()
public org.apache.velocity.VelocityContext getVelocityContext()
public abstract java.lang.String getVelocityTemplatePath()
public org.apache.velocity.Template getVelocityTemplate() throws XCodeGenException
XCodeGenException
- if the template not foundprotected abstract void generate(XPackage pkg, org.apache.velocity.VelocityContext context, org.apache.velocity.Template template) throws XCodeGenException, java.io.IOException
pkg
- Package to generatecontext
- Velocity contexttemplate
- Template used for generating the code
XCodeGenException
- If any error occurs during the code generation
java.io.IOException
protected abstract void generate(XClass clazz, org.apache.velocity.VelocityContext context, org.apache.velocity.Template template) throws XCodeGenException, java.io.IOException
clazz
- Class to generatecontext
- Velocity contexttemplate
- Template used for generating the code
XCodeGenException
- If any error occurs during the code generation
java.io.IOException
protected java.util.Properties loadResourceAsProperties(java.lang.String path) throws XCodeGenException
path
- path of the resource
XCodeGenException
- if the resource not loadedpublic void generate(XPackage[] packages) throws XCodeGenException, java.io.IOException
CodeGenerator
generate
in interface CodeGenerator
java.io.IOException
- if any IO error
XCodeGenException
public java.lang.String getConfigProperty(java.lang.String name, java.lang.String defaultValue)
CodeGenerator
getConfigProperty
in interface CodeGenerator
name
- Name of the property requesteddefaultValue
- default value
public void init(java.util.Properties config) throws XCodeGenException
CodeGenerator
init
in interface CodeGenerator
config
- Configuration of the code generator
XCodeGenException
- if any error occurs during the initialization
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |