Class FreeMarkerTemplateEngine
java.lang.Object
de.monticore.generating.templateengine.freemarker.FreeMarkerTemplateEngine
Helps to process FreeMarker templates with MontiCore.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final freemarker.template.Configurationstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidloadAndRun(String qualifiedTemplateName, StringBuilder buffer, Object data) Loads the template first using the loadTemplate() method then runs the template engine using the run() method.freemarker.template.TemplateloadTemplate(String qualifiedTemplateName) Loads the template named qualifiedTemplateName from the class path.voidrun(StringBuilder buffer, Object data, freemarker.template.Template template) Runs the Template engine on the given template and data and writes the result into the StringBuilder buffer
-
Field Details
-
FM_FILE_EXTENSION
- See Also:
-
configuration
protected final freemarker.template.Configuration configuration
-
-
Constructor Details
-
FreeMarkerTemplateEngine
public FreeMarkerTemplateEngine(freemarker.template.Configuration configuration)
-
-
Method Details
-
loadTemplate
Loads the template named qualifiedTemplateName from the class path.- Parameters:
qualifiedTemplateName- full qualified template name EXCLUDING the file extension- Returns:
- the FreeMarker template or null, if the template is not available
-
run
Runs the Template engine on the given template and data and writes the result into the StringBuilder buffer- Parameters:
buffer- contains the resultdata- data for the templatetemplate- the template file
-
loadAndRun
Loads the template first using the loadTemplate() method then runs the template engine using the run() method.- Parameters:
qualifiedTemplateName- full qualified template name EXCLUDING the file extensionbuffer- contains the resultdata- data for the template
-