Class FreeMarkerHelper

java.lang.Object
org.codehaus.mojo.license.api.FreeMarkerHelper

public class FreeMarkerHelper extends Object
A helper to deal with freemarker templating.
Since:
1.1
Author:
tchemit dev@tchemit.fr
  • Field Details

    • TEMPLATE

      public static final String TEMPLATE
      See Also:
    • freemarkerConfiguration

      protected final freemarker.template.Configuration freemarkerConfiguration
      Shared freemarker configuration. Note: The configuration is auto loading as needed.
    • templateLoader

      protected final freemarker.cache.TemplateLoader templateLoader
  • Constructor Details

    • FreeMarkerHelper

      protected FreeMarkerHelper(freemarker.cache.TemplateLoader templateLoader)
  • Method Details

    • newDefaultHelper

      public static FreeMarkerHelper newDefaultHelper()
      Returns:
      a default helper, if template is a file, then will use it as it, otherwise will have a look into classloader in current package.
    • newHelperFromContent

      public static FreeMarkerHelper newHelperFromContent(String stringTemplate)
      Parameters:
      stringTemplate - template
      Returns:
      a helper, if template is a file, then will use it as it, otherwise will use the given template
    • getTemplate

      public freemarker.template.Template getTemplate(String templateName) throws IOException
      Throws:
      IOException
    • renderTemplate

      public String renderTemplate(String templateName, Map<String,Object> parameters) throws IOException
      Throws:
      IOException
    • renderTemplate

      public String renderTemplate(freemarker.template.Template template, Map<String,Object> parameters) throws IOException
      Throws:
      IOException