@Service public class TemplateEngineRegistryDefaultImpl extends Object implements ITemplateEngineRegistry, ITemplateEngineFactory
A default registry for ITemplateEngine.
Any template engine should to be registered with register(ITemplateEngine) method.
| Constructor and Description |
|---|
TemplateEngineRegistryDefaultImpl() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getRegisteredTemplateLanguages()
Return an immutable list of registered template engine languages.
|
Optional<ITemplateEngine> |
getTemplateEngine(@NotBlank String templateLanguage)
Get the
template engine associated with the indicated templateLanguage. |
void |
register(@NotNull @Valid ITemplateEngine templateEngine)
Register a new
templateEngine for use. |
String |
renderTemplate(@NotNull @Valid TemplateInstanceBean template)
Render the indicated
template without variables to generate output. |
public Optional<ITemplateEngine> getTemplateEngine(@NotBlank @NotBlank String templateLanguage)
Get the template engine associated with the indicated templateLanguage.
getTemplateEngine in interface ITemplateEngineFactorytemplateLanguage - The template language, is a text literal that identify uniquely a template engine, by example: thymeleaf, velocity, mustache, etc.Optional.empty() if no template engine was found for the indicated templateLanguagepublic List<String> getRegisteredTemplateLanguages()
Return an immutable list of registered template engine languages.
getRegisteredTemplateLanguages in interface ITemplateEngineFactorypublic void register(@NotNull @Valid
@NotNull @Valid ITemplateEngine templateEngine)
Register a new templateEngine for use.
ATENTION If another template engine was configured with same template language, this one overwrites the previously registered.
register in interface ITemplateEngineRegistrytemplateEngine - The template enginepublic String renderTemplate(@NotNull @Valid @NotNull @Valid TemplateInstanceBean template)
Render the indicated template without variables to generate output.
renderTemplate in interface IEngineRendertemplate - The template definitionCopyright © 2021 Albirar. All rights reserved.