- All Known Implementing Classes:
BeetlTemplate,FreemarkerTemplate,ThymeleafTemplate
public interface Template
Abstract template interface. This interface defines the contract for template rendering operations, allowing for
various template engines to be used interchangeably.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringRenders the template with the given binding parameters and returns the result as aString.default voidRenders the template with the given binding parameters and writes the result to a specifiedFile.voidrender(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.
-
Method Details
-
render
Renders the template with the given binding parameters and writes the result to aWriter.- Parameters:
bindingMap- A map of parameters to bind to the template variables.writer- TheWriterto which the rendered content will be written.
-
render
Renders the template with the given binding parameters and writes the result to anOutputStream.- Parameters:
bindingMap- A map of parameters to bind to the template variables.out- TheOutputStreamto which the rendered content will be written.
-
render
Renders the template with the given binding parameters and writes the result to a specifiedFile. The output stream will be automatically closed after rendering.- Parameters:
bindingMap- A map of parameters to bind to the template variables.file- TheFileto which the rendered content will be written.
-
render
Renders the template with the given binding parameters and returns the result as aString.- Parameters:
bindingMap- A map of parameters to bind to the template variables.- Returns:
- The rendered content as a
String.
-