@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 ITemplateEngineFactory
templateLanguage
- 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 templateLanguage
public List<String> getRegisteredTemplateLanguages()
Return an immutable list of registered template engine languages.
getRegisteredTemplateLanguages
in interface ITemplateEngineFactory
public 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 ITemplateEngineRegistry
templateEngine
- The template enginepublic String renderTemplate(@NotNull @Valid @NotNull @Valid TemplateInstanceBean template)
Render the indicated template
without variables to generate output.
renderTemplate
in interface IEngineRender
template
- The template definitionCopyright © 2021 Albirar. All rights reserved.