xcodegen.generator.bean
Class AbstractBeanCodeGenerator

java.lang.Object
  |
  +--xcodegen.generator.AbstractCodeGenerator
        |
        +--xcodegen.generator.bean.AbstractBeanCodeGenerator
All Implemented Interfaces:
CodeGenerator
Direct Known Subclasses:
DAOCodeGenerator, DTOCodeGenerator, StrutsCodeGenerator

public abstract class AbstractBeanCodeGenerator
extends AbstractCodeGenerator

Base class of JavaBean code generators

Version:
$Revision: 1.2 $
Author:
Herve Tchepannou

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, VERSION
 
Constructor Summary
AbstractBeanCodeGenerator(java.lang.String name)
          Create a new BeanCodeGenerator
 
Method Summary
protected  void generate(XClass clazz, org.apache.velocity.VelocityContext context, org.apache.velocity.Template template)
          Generate the code of a class
protected  void generate(XPackage pkg, org.apache.velocity.VelocityContext context, org.apache.velocity.Template template)
          Generate the code of a package
 java.lang.String getClassname(XClass clazz)
          Return the name of a class by adding a prefix and a suffix
 java.lang.String getPackagename(XPackage pkg)
          Return the name of a package by adding a suffix
 java.lang.String getType(java.lang.String type)
          Return the type for the targeted language
 java.lang.String getVelocityTemplatePath()
          Return the path the the template
 void init(java.util.Properties config)
          Initialize the code generator
 
Methods inherited from class xcodegen.generator.AbstractCodeGenerator
generate, getConfigProperty, getLogger, getName, getVelocityContext, getVelocityTemplate, loadResourceAsProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBeanCodeGenerator

public AbstractBeanCodeGenerator(java.lang.String name)
Create a new BeanCodeGenerator

Parameters:
name - name of the code generator
Method Detail

getPackagename

public java.lang.String getPackagename(XPackage pkg)
Return the name of a package by adding a suffix

Parameters:
pkg -
Returns:
name of the package

getClassname

public java.lang.String getClassname(XClass clazz)
Return the name of a class by adding a prefix and a suffix

Parameters:
clazz - Class
Returns:
classname

getType

public java.lang.String getType(java.lang.String type)
Return the type for the targeted language

Parameters:
type - type name
Returns:
mapped type to the target language

init

public void init(java.util.Properties config)
          throws XCodeGenException
Description copied from interface: CodeGenerator
Initialize the code generator

Specified by:
init in interface CodeGenerator
Overrides:
init in class AbstractCodeGenerator
Parameters:
config - Configuration of the code generator
Throws:
XCodeGenException - if any error occurs during the initialization

getVelocityTemplatePath

public java.lang.String getVelocityTemplatePath()
Description copied from class: AbstractCodeGenerator
Return the path the the template

Specified by:
getVelocityTemplatePath in class AbstractCodeGenerator
Returns:
path of the template

generate

protected void generate(XPackage pkg,
                        org.apache.velocity.VelocityContext context,
                        org.apache.velocity.Template template)
                 throws XCodeGenException,
                        java.io.IOException
Description copied from class: AbstractCodeGenerator
Generate the code of a package

Specified by:
generate in class AbstractCodeGenerator
Parameters:
pkg - Package to generate
context - Velocity context
template - Template used for generating the code
Throws:
XCodeGenException - If any error occurs during the code generation
java.io.IOException

generate

protected void generate(XClass clazz,
                        org.apache.velocity.VelocityContext context,
                        org.apache.velocity.Template template)
                 throws XCodeGenException,
                        java.io.IOException
Description copied from class: AbstractCodeGenerator
Generate the code of a class

Specified by:
generate in class AbstractCodeGenerator
Parameters:
clazz - Class to generate
context - Velocity context
template - Template used for generating the code
Throws:
XCodeGenException - If any error occurs during the code generation
java.io.IOException