org.hibernate.tool.hbm2x
Class TemplateHelper
java.lang.Object
org.hibernate.tool.hbm2x.TemplateHelper
public class TemplateHelper
- extends Object
Helper and wrapper for a Template engine (currently only FreeMarker).
Exposes only the essential functions to avoid too much coupling else where.
- Author:
- max
Field Summary |
protected freemarker.template.SimpleHash |
context
|
protected freemarker.template.Configuration |
freeMarkerEngine
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
freeMarkerEngine
protected freemarker.template.Configuration freeMarkerEngine
context
protected freemarker.template.SimpleHash context
TemplateHelper
public TemplateHelper()
init
public void init(File outputDirectory,
String[] templatePaths)
getOutputDirectory
public File getOutputDirectory()
putInContext
public void putInContext(String key,
Object value)
removeFromContext
public void removeFromContext(String key,
Object expected)
ensureExistence
public void ensureExistence(File destination)
getTemplatePrefix
protected String getTemplatePrefix()
getContext
protected freemarker.template.SimpleHash getContext()
processString
public void processString(String template,
Writer output)
setupContext
public void setupContext()
internalPutInContext
protected Object internalPutInContext(String key,
Object value)
internalRemoveFromContext
protected Object internalRemoveFromContext(String key)
processTemplate
public void processTemplate(String templateName,
Writer output,
String rootContext)
- look up the template named templateName via the paths and print the content to the output
templateExists
public boolean templateExists(String templateName)
- Check if the template exists. Tries to search with the templatePrefix first and then secondly without the template prefix.
- Parameters:
name
-
- Returns: