Module bus.extra

Class BeetlTemplate

java.lang.Object
org.miaixz.bus.extra.template.provider.beetl.BeetlTemplate
All Implemented Interfaces:
Serializable, Template

public class BeetlTemplate extends Object implements Template, Serializable
Beetl template implementation. This class wraps a Beetl Template object, providing a unified interface for rendering templates.
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    BeetlTemplate(org.beetl.core.Template beetlTemplate)
    Constructs a new BeetlTemplate instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    render(Map<?,?> bindingMap, OutputStream out)
    Renders the template with the given binding parameters and writes the result to an OutputStream.
    void
    render(Map<?,?> bindingMap, Writer writer)
    Renders the template with the given binding parameters and writes the result to a Writer.
    wrap(org.beetl.core.Template beetlTemplate)
    Wraps a Beetl template object into a BeetlTemplate instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.miaixz.bus.extra.template.Template

    render, render
  • Constructor Details

    • BeetlTemplate

      public BeetlTemplate(org.beetl.core.Template beetlTemplate)
      Constructs a new BeetlTemplate instance.
      Parameters:
      beetlTemplate - The raw Beetl template object to be wrapped. Must not be null.
  • Method Details

    • wrap

      public static BeetlTemplate wrap(org.beetl.core.Template beetlTemplate)
      Wraps a Beetl template object into a BeetlTemplate instance.
      Parameters:
      beetlTemplate - The raw Beetl template object (Template).
      Returns:
      A new BeetlTemplate instance, or null if the input beetlTemplate is null.
    • render

      public void render(Map<?,?> bindingMap, Writer writer)
      Description copied from interface: Template
      Renders the template with the given binding parameters and writes the result to a Writer.
      Specified by:
      render in interface Template
      Parameters:
      bindingMap - A map of parameters to bind to the template variables.
      writer - The Writer to which the rendered content will be written.
    • render

      public void render(Map<?,?> bindingMap, OutputStream out)
      Description copied from interface: Template
      Renders the template with the given binding parameters and writes the result to an OutputStream.
      Specified by:
      render in interface Template
      Parameters:
      bindingMap - A map of parameters to bind to the template variables.
      out - The OutputStream to which the rendered content will be written.