Class TemplateHelper
java.lang.Object
org.hibernate.tool.internal.export.common.TemplateHelper
Helper and wrapper for a Template engine (currently only FreeMarker).
Exposes only the essential functions to avoid too much coupling else where.
- Author:
- max
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected freemarker.template.SimpleHashprotected freemarker.template.Configuration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidensureExistence(File destination) protected freemarker.template.SimpleHashprotected Stringvoidprotected ObjectinternalPutInContext(String key, Object value) protected ObjectvoidprocessString(String template, Writer output) voidprocessTemplate(String templateName, Writer output, String rootContext) look up the template named templateName via the paths and print the content to the outputvoidputInContext(String key, Object value) voidremoveFromContext(String key, Object expected) voidbooleantemplateExists(String templateName) Check if the template exists.
-
Field Details
-
freeMarkerEngine
protected freemarker.template.Configuration freeMarkerEngine -
context
protected freemarker.template.SimpleHash context
-
-
Constructor Details
-
TemplateHelper
public TemplateHelper()
-
-
Method Details
-
init
-
getOutputDirectory
-
putInContext
-
removeFromContext
-
ensureExistence
-
getTemplatePrefix
-
getContext
protected freemarker.template.SimpleHash getContext() -
processString
-
setupContext
public void setupContext() -
internalPutInContext
-
internalRemoveFromContext
-
processTemplate
look up the template named templateName via the paths and print the content to the output -
templateExists
Check if the template exists. Tries to search with the templatePrefix first and then secondly without the template prefix.- Parameters:
name-- Returns:
-