Class HandlebarsTemplateCompiler
- java.lang.Object
-
- org.rodnansol.core.generator.template.handlebars.HandlebarsTemplateCompiler
-
- All Implemented Interfaces:
TemplateCompiler
public class HandlebarsTemplateCompiler extends Object implements TemplateCompiler
Template compiler implementation that uses Handlebarsto compile a template.Implementation is using custom helpers:
- as_env - Converts the property key to its environment variable format.
- is_included - Checks if the given parameters should be rendered in the final document or not.
- is_compact_mode - Checks if the incoming template customization has the compact mode enabled or not.
- Since:
- 0.1.2
- Author:
- nandorholozsnyak
-
-
Field Summary
Fields Modifier and Type Field Description static TemplateCompilerINSTANCE
-
Constructor Summary
Constructors Constructor Description HandlebarsTemplateCompiler()HandlebarsTemplateCompiler(com.github.jknack.handlebars.Handlebars handlebars, com.github.jknack.handlebars.helper.I18nHelper i18nHelper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcompileTemplate(String templatePath, TemplateData templateData)Compiles the template with the given template data.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.rodnansol.core.generator.template.compiler.TemplateCompiler
getMemoryStore
-
-
-
-
Field Detail
-
INSTANCE
public static final TemplateCompiler INSTANCE
-
-
Method Detail
-
compileTemplate
public String compileTemplate(String templatePath, TemplateData templateData) throws DocumentGenerationException
Description copied from interface:TemplateCompilerCompiles the template with the given template data.If the template is not found an exception must be raised.
- Specified by:
compileTemplatein interfaceTemplateCompiler- Parameters:
templatePath- path to the template that the compiler can understand and work with.templateData- template data.- Returns:
- templated populated and compiled with the given template data.
- Throws:
DocumentGenerationException- when the template compiler occurs an error.
-
-