Package sonia.scm.template
Interface TemplateEngine
public interface TemplateEngine
The
TemplateEngine
searches for Template
s and prepares the
template for the rendering process.- Since:
- 1.19
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
extendWithLanguage
(String templatePath, Locale locale) getTemplate
(String templatePath) Returns the template associated with the given path.getTemplate
(String templateIdentifier, Reader reader) Creates a template of the given reader.default Template
getTemplate
(String templatePath, Locale locale) Returns the template associated with the given path and the given language or the default version.getType()
-
Method Details
-
getTemplate
Returns the template associated with the given path. The template engine will search the template in the folder of the web application and in the classpath. This method will return null, if no template could be found for the given path.- Parameters:
templatePath
- path of the template- Returns:
- template associated with the given path or null
- Throws:
IOException
-
getTemplate
Returns the template associated with the given path and the given language or the default version. To do this, the template path will be extended with the language. For example `my-template.type` will be extended to `my-template_en.type`, if the language isLocale.ENGLISH
. If no dedicated template can be found, the template without the extension will be used.The template engine will search the template in the folder of the web application and in the classpath. This method will return null, if no template could be found for the given path.
- Parameters:
templatePath
- path of the templatelocale
- the preferred language- Returns:
- template associated with the given path, extended by the language if found, or null
- Throws:
IOException
-
getTemplate
Creates a template of the given reader. Note some template implementations will cache the template by its id.- Parameters:
templateIdentifier
- id of the templatereader
- template reader- Returns:
- template created from the reader
- Throws:
IOException
- Since:
- 1.22
-
getType
TemplateType getType() -
extendWithLanguage
-