Module bus.extra

Class TemplateKit

java.lang.Object
org.miaixz.bus.extra.template.TemplateKit

public class TemplateKit extends Object
Provides template utility methods for quick template merging and rendering.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • TemplateKit

      public TemplateKit()
  • Method Details

    • getEngine

      public static TemplateProvider getEngine()
      Retrieves a singleton instance of the template engine.
      Returns:
      The singleton TemplateProvider instance.
    • render

      public static String render(String templateContent, Map<?,?> bindingMap)
      Renders the given template content with the provided binding parameters and returns the result as a string.
      Parameters:
      templateContent - The template content to be rendered.
      bindingMap - A map of parameters to bind to the template variables.
      Returns:
      The rendered content as a String.
    • render

      public static void render(String templateContent, Map<?,?> bindingMap, Writer writer)
      Renders the given template content with the provided binding parameters and writes the result to a Writer.
      Parameters:
      templateContent - The template content to be rendered.
      bindingMap - A map of parameters to bind to the template variables.
      writer - The Writer to which the rendered content will be written.