java.lang.Object
org.miaixz.bus.extra.template.provider.freemarker.FreemarkerTemplate
- All Implemented Interfaces:
Serializable,Template
Freemarker template implementation. This class wraps a FreeMarker
Template object,
providing a unified interface for rendering templates.- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFreemarkerTemplate(freemarker.template.Template freemarkerTemplate) Constructs a newFreemarkerTemplateinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidrender(Map<?, ?> bindingMap, OutputStream out) Renders the template with the given binding parameters and writes the result to anOutputStream.voidRenders the template with the given binding parameters and writes the result to aWriter.static FreemarkerTemplatewrap(freemarker.template.Template freemarkerTemplate) Wraps a FreeMarker template object into aFreemarkerTemplateinstance.
-
Constructor Details
-
FreemarkerTemplate
public FreemarkerTemplate(freemarker.template.Template freemarkerTemplate) Constructs a newFreemarkerTemplateinstance.- Parameters:
freemarkerTemplate- The raw FreeMarker template object to be wrapped. Must not benull.
-
-
Method Details
-
wrap
Wraps a FreeMarker template object into aFreemarkerTemplateinstance.- Parameters:
freemarkerTemplate- The raw FreeMarker template object (Template).- Returns:
- A new
FreemarkerTemplateinstance, ornullif the inputfreemarkerTemplateisnull.
-
render
Description copied from interface:TemplateRenders the template with the given binding parameters and writes the result to aWriter. -
render
Description copied from interface:TemplateRenders the template with the given binding parameters and writes the result to anOutputStream.- Specified by:
renderin interfaceTemplate- Parameters:
bindingMap- A map of parameters to bind to the template variables.out- TheOutputStreamto which the rendered content will be written.
-