Package science.aist.gtf.visualization
Class FreemarkerPrinter<T>
- java.lang.Object
 - 
- science.aist.gtf.visualization.FreemarkerPrinter<T>
 
 
- 
- Type Parameters:
 T- The type of the input context
- All Implemented Interfaces:
 TemplateEngine<T>
- Direct Known Subclasses:
 ExceptionPrinter
public class FreemarkerPrinter<T> extends Object implements TemplateEngine<T>
Printer that is based on freemarker. It will persist according to the given template files
- Since:
 - 1.0
 - Author:
 - Oliver Krauss, Andreas Pointner
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected freemarker.template.Configurationconfiguration 
- 
Constructor Summary
Constructors Constructor Description FreemarkerPrinter(String templateDirectory)Creates the default configuration and set the template loading 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdditionalTemplateValue(String key, Object value)Adds a value that has to be used by the template (does override if exists)voidaddTemplate(String name, String templateFile)<S> voidaddTemplatePreprocessor(TemplatePreprocessor<S> templatePreprocessor)protected voidapplyTemplate(String templateName, Map<String,Object> data)Helper function to actually apply the templatevoidprocess(T context, String templateFile, Writer destinationWriter)Runs the enginevoidremoveAdditionalTemplateValue(String key)Removes a value from the template<S> voidremoveTemplatePreprocessor(TemplatePreprocessor<S> templatePreprocessor)voidsetFormat(String format)voidtransform(String template, Object o) 
 - 
 
- 
- 
Constructor Detail
- 
FreemarkerPrinter
public FreemarkerPrinter(String templateDirectory)
Creates the default configuration and set the template loading- Parameters:
 templateDirectory- if null then this class will be used for template loading, otherwise the directory which was set is used
 
 - 
 
- 
Method Detail
- 
applyTemplate
protected void applyTemplate(String templateName, Map<String,Object> data)
Helper function to actually apply the template- Parameters:
 templateName- to be applieddata- to be printed into the template
 
- 
addAdditionalTemplateValue
public void addAdditionalTemplateValue(String key, Object value)
Adds a value that has to be used by the template (does override if exists)- Parameters:
 key- to be usedvalue- to be applied to the template
 
- 
removeAdditionalTemplateValue
public void removeAdditionalTemplateValue(String key)
Removes a value from the template- Parameters:
 key- to be removed
 
- 
setFormat
public void setFormat(String format)
 
- 
addTemplatePreprocessor
public <S> void addTemplatePreprocessor(TemplatePreprocessor<S> templatePreprocessor)
 
- 
removeTemplatePreprocessor
public <S> void removeTemplatePreprocessor(TemplatePreprocessor<S> templatePreprocessor)
 
- 
process
public void process(T context, String templateFile, Writer destinationWriter)
Description copied from interface:TemplateEngineRuns the engine- Specified by:
 processin interfaceTemplateEngine<T>- Parameters:
 context- the context in which this should happentemplateFile- the template filedestinationWriter- the writer for the result
 
 - 
 
 -