Class FreeMarkerTemplateEngine

java.lang.Object
de.monticore.generating.templateengine.freemarker.FreeMarkerTemplateEngine

public class FreeMarkerTemplateEngine extends Object
Helps to process FreeMarker templates with MontiCore.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final freemarker.template.Configuration
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FreeMarkerTemplateEngine(freemarker.template.Configuration configuration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    loadAndRun(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.Template
    loadTemplate(String qualifiedTemplateName)
    Loads the template named qualifiedTemplateName from the class path.
    void
    run(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FM_FILE_EXTENSION

      public static final String FM_FILE_EXTENSION
      See Also:
    • configuration

      protected final freemarker.template.Configuration configuration
  • Constructor Details

    • FreeMarkerTemplateEngine

      public FreeMarkerTemplateEngine(freemarker.template.Configuration configuration)
  • Method Details

    • loadTemplate

      public freemarker.template.Template loadTemplate(String qualifiedTemplateName)
      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

      public void run(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
      Parameters:
      buffer - contains the result
      data - data for the template
      template - the template file
    • loadAndRun

      public void loadAndRun(String qualifiedTemplateName, StringBuilder buffer, Object data)
      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 extension
      buffer - contains the result
      data - data for the template