org.hibernate.tool.hbm2x
Class DAONewExporter

java.lang.Object
  extended by org.hibernate.tool.hbm2x.AbstractExporter
      extended by org.hibernate.tool.hbm2x.GenericExporter
          extended by org.hibernate.tool.hbm2x.DAONewExporter
All Implemented Interfaces:
Exporter

public class DAONewExporter
extends GenericExporter

Creates domain model abstract base classes from .hbm files

Author:
Alex Kalinovsky

Field Summary
protected  String filePattern
           
 
Fields inherited from class org.hibernate.tool.hbm2x.AbstractExporter
log, templatePaths
 
Constructor Summary
DAONewExporter()
           
DAONewExporter(org.hibernate.cfg.Configuration cfg, File outputdir)
           
 
Method Summary
 void doStart()
          Override to control file overwriting via isOverrite() method
protected  void exportPOJO(Map additionalContext, POJOClass element)
          Override to avoid overwriting the existing files In the final version this should be moved to GenericExporter
 String getProperty(String key)
          Helper method to lookup a property
 boolean isOverwrite()
          Checks if the file overwriting is true (default) or false
 String replaceParameters(String pattern, Map paramValues)
          Helper method that replaces all parameters in a given pattern
protected  void setupContext()
          Setup the context variables used by the exporter.
 
Methods inherited from class org.hibernate.tool.hbm2x.GenericExporter
exportComponent, exportPersistentClass, getClassNameForFile, getFilePattern, getPackageNameForFile, getTemplateName, resolveFilename, setFilePattern, setForEach, setTemplateName
 
Methods inherited from class org.hibernate.tool.hbm2x.AbstractExporter
cleanUpContext, getArtifactCollector, getCfg2HbmTool, getCfg2JavaTool, getConfiguration, getFileForClassName, getName, getOutputDirectory, getProperties, getTemplateHelper, getTemplatePath, getTemplatePaths, setArtifactCollector, setConfiguration, setOutputDirectory, setProperties, setTemplateHelper, setTemplatePath, setupTemplates, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filePattern

protected String filePattern
Constructor Detail

DAONewExporter

public DAONewExporter(org.hibernate.cfg.Configuration cfg,
                      File outputdir)

DAONewExporter

public DAONewExporter()
Method Detail

setupContext

protected void setupContext()
Description copied from class: AbstractExporter
Setup the context variables used by the exporter. Subclasses should call super.setupContext() to ensure all needed variables are in the context.

Overrides:
setupContext in class AbstractExporter

getProperty

public String getProperty(String key)
Helper method to lookup a property


doStart

public void doStart()
Override to control file overwriting via isOverrite() method

Overrides:
doStart in class GenericExporter

exportPOJO

protected void exportPOJO(Map additionalContext,
                          POJOClass element)
Override to avoid overwriting the existing files In the final version this should be moved to GenericExporter

Overrides:
exportPOJO in class GenericExporter

isOverwrite

public boolean isOverwrite()
Checks if the file overwriting is true (default) or false

Returns:

replaceParameters

public String replaceParameters(String pattern,
                                Map paramValues)
Helper method that replaces all parameters in a given pattern

Parameters:
pattern - String with parameters surrounded with braces, for instance "Today is {day} day of {month}"
paramValues - map with key-value pairs for parameter values
Returns:
string where parameters are replaced with their values