java.lang.Object
org.miaixz.bus.extra.template.TemplateFactory
Simple template engine factory that automatically creates the corresponding template engine object based on the
template engine JARs introduced by the user. It uses the Simple Factory pattern.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TemplateProvidercreate()Creates a newTemplateProviderinstance using the default configuration.static TemplateProvidercreate(TemplateConfig config) Creates a newTemplateProviderinstance with the specified configuration.static TemplateProviderget()Retrieves a singleton instance ofTemplateProviderbased on the available template engine JARs.
-
Constructor Details
-
TemplateFactory
public TemplateFactory()
-
-
Method Details
-
get
Retrieves a singleton instance ofTemplateProviderbased on the available template engine JARs. The first available template engine found via SPI will be used.- Returns:
- A singleton instance of
TemplateProvider.
-
create
Creates a newTemplateProviderinstance using the default configuration. This method returns a new engine instance each time it is called.- Returns:
- A new
TemplateProviderinstance.
-
create
Creates a newTemplateProviderinstance with the specified configuration. This method returns a new engine instance each time it is called.- Parameters:
config- The template configuration, including encoding, template file path, etc.- Returns:
- A new
TemplateProviderinstance.
-