Package org.codehaus.mojo.license.api
Class FreeMarkerHelper
java.lang.Object
org.codehaus.mojo.license.api.FreeMarkerHelper
A helper to deal with freemarker templating.
- Since:
- 1.1
- Author:
- tchemit dev@tchemit.fr
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final freemarker.template.Configuration
Shared freemarker configuration.static final String
protected final freemarker.cache.TemplateLoader
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FreeMarkerHelper
(freemarker.cache.TemplateLoader templateLoader) -
Method Summary
Modifier and TypeMethodDescriptionfreemarker.template.Template
getTemplate
(String templateName) static FreeMarkerHelper
static FreeMarkerHelper
newHelperFromContent
(String stringTemplate) renderTemplate
(freemarker.template.Template template, Map<String, Object> parameters) renderTemplate
(String templateName, Map<String, Object> parameters)
-
Field Details
-
TEMPLATE
- See Also:
-
freemarkerConfiguration
protected final freemarker.template.Configuration freemarkerConfigurationShared 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
- 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
- Parameters:
stringTemplate
- template- Returns:
- a helper, if template is a file, then will use it as it, otherwise will use the given template
-
getTemplate
- Throws:
IOException
-
renderTemplate
- Throws:
IOException
-
renderTemplate
public String renderTemplate(freemarker.template.Template template, Map<String, Object> parameters) throws IOException- Throws:
IOException
-