org.objectweb.jorm.comp.generator.lib
Class ObjectGenerator

java.lang.Object
  |
  +--org.objectweb.jorm.comp.generator.lib.ObjectGenerator
All Implemented Interfaces:
Generator, Loggable
Direct Known Subclasses:
AccessorGenerator, BinderGenerator, BindingGenerator, CompositeNameGenerator, MappingGenerator, PNameGenerator

public abstract class ObjectGenerator
extends java.lang.Object
implements Generator, Loggable

This class contains the common elements for generating jorm objects (mapping, binding, accessors)


Field Summary
protected  org.objectweb.util.monolog.api.Logger logger
          The logger instance which logs the traces of the generator.
protected  org.objectweb.util.monolog.api.LoggerFactory loggerFactory
          The logger factory instance which permits to fetch Logger instance.
static java.lang.String TEMPLATE_DIR
          The base directory where to find velocity template.
 
Constructor Summary
ObjectGenerator()
           
 
Method Summary
abstract  void generate(MetaObject pod, org.objectweb.util.io.api.TargetHolder holder, CompilerParameter cp)
          A part of the generate
 org.objectweb.util.monolog.api.Logger getLogger()
          Returns a logger to an component that wants to log things.
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 org.apache.velocity.app.VelocityEngine initVelocity()
          It initializes a new VelocityEngine.
 void setLogger(org.objectweb.util.monolog.api.Logger l)
          Assigns a logger to an component that wants to log things.
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
          Assigns a logger factory that allows the creation of new loggers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE_DIR

public static final java.lang.String TEMPLATE_DIR
The base directory where to find velocity template.

logger

protected org.objectweb.util.monolog.api.Logger logger
The logger instance which logs the traces of the generator.

loggerFactory

protected org.objectweb.util.monolog.api.LoggerFactory loggerFactory
The logger factory instance which permits to fetch Logger instance.
Constructor Detail

ObjectGenerator

public ObjectGenerator()
Method Detail

initVelocity

public org.apache.velocity.app.VelocityEngine initVelocity()
It initializes a new VelocityEngine.
Returns:
A new VelocityEngine instance initialized for the generation of the JORM obbjects

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
Description copied from interface: Loggable
Assigns a logger factory that allows the creation of new loggers.
Specified by:
setLoggerFactory in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
loggerfactory - the LoggerFactory object to obtain new loggers

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger l)
Description copied from interface: Loggable
Assigns a logger to an component that wants to log things.
Specified by:
setLogger in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
logger - the logger object

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.
Specified by:
getLogger in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
logger - the logger object

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.
Specified by:
getLoggerFactory in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
loggerfactory - the LoggerFactory object to obtain new loggers

generate

public abstract void generate(MetaObject pod,
                              org.objectweb.util.io.api.TargetHolder holder,
                              CompilerParameter cp)
                       throws java.lang.Exception
A part of the generate
Specified by:
generate in interface Generator
Parameters:
pod - the meta object interface
th - The target holder which allows to create files