Module bus.extra

Interface TemplateProvider

All Superinterfaces:
org.miaixz.bus.core.Provider, Serializable, org.miaixz.bus.core.lang.Wrapper<Object>
All Known Implementing Classes:
BeetlProvider, FreemarkerProvider, ThymeleafProvider

public interface TemplateProvider extends org.miaixz.bus.core.lang.Wrapper<Object>
Interface for template engine providers. Implementations of this interface wrap specific template engines, providing a unified way to initialize and retrieve templates.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    getTemplate(String resource)
    Retrieves a Template object based on the provided resource.
    Initializes the template engine with the specified configuration.

    Methods inherited from interface org.miaixz.bus.core.lang.Wrapper

    getRaw, type
  • Method Details

    • init

      Initializes the template engine with the specified configuration.
      Parameters:
      config - The TemplateConfig containing initialization parameters for the template engine.
      Returns:
      This TemplateProvider instance, initialized with the given configuration.
    • getTemplate

      Template getTemplate(String resource)
      Retrieves a Template object based on the provided resource. The interpretation of the resource string depends on the specific template engine implementation; it could be the template content itself or a relative path to the template file.
      Parameters:
      resource - The resource identifier for the template.
      Returns:
      A Template instance ready for rendering.