Package org.spincast.core.templating
Interface TemplatingEngine
- All Known Implementing Classes:
SpincastPebbleTemplatingEngine
public interface TemplatingEngine
Component that "evaluates" some templates or inline content, using some parameters.
The most frequent use of this is
to generate an
HTML
page to render.-
Method Summary
Modifier and TypeMethodDescriptioncreatePlaceholder
(String variable) Creates a placeholder using the current templating engine implementation.Evaluates the content, without parameters.Evaluates the content, using the given parameters.Evaluates the content, using the given parameters.evaluate
(String content, JsonObject jsonObject) Evaluates the content, using the given parameters.evaluate
(String content, JsonObject jsonObject, Locale locale) Evaluates the content, using the given parameters.fromTemplate
(String templatePath, boolean isClasspathPath, Map<String, Object> params) Evaluates a template using the given parameters.fromTemplate
(String templatePath, boolean isClasspathPath, Map<String, Object> params, Locale locale) Evaluates a template using the given parameters.fromTemplate
(String templatePath, boolean isClasspathPath, JsonObject jsonObject) Evaluates a template using the parameters specified as aJsonObject
.fromTemplate
(String templatePath, boolean isClasspathPath, JsonObject jsonObject, Locale locale) Evaluates a template using the parameters specified as aJsonObject
.fromTemplate
(String templatePath, Map<String, Object> params) Evaluates a template using the given parameters.Evaluates a template using the given parameters.fromTemplate
(String templatePath, JsonObject jsonObject) Evaluates a template using the parameters specified as aJsonObject
.fromTemplate
(String templatePath, JsonObject jsonObject, Locale locale) Evaluates a template using the parameters specified as aJsonObject
.
-
Method Details
-
evaluate
Evaluates the content, without parameters.Uses the default Locale.
-
evaluate
Evaluates the content, using the given parameters. Uses the default Locale. -
evaluate
Evaluates the content, using the given parameters. Uses the specified Locale. -
evaluate
Evaluates the content, using the given parameters. specified as aJsonObject
. Uses the default Locale. -
evaluate
Evaluates the content, using the given parameters. specified as aJsonObject
. Uses the specified Locale. -
fromTemplate
Evaluates a template using the given parameters. Uses the default Locale.- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Evaluates a template using the given parameters. Uses the specified Locale.- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Evaluates a template using the parameters specified as aJsonObject
. Uses the default Locale.- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Evaluates a template using the parameters specified as aJsonObject
. Uses the specified Locale.- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Evaluates a template using the given parameters. Uses the default Locale.- Parameters:
isClasspathPath
- iftrue
, the 'templatePath' is considered as a classpath's relative path. Iffalse
, it is considered as an absolute file system path.
-
fromTemplate
String fromTemplate(String templatePath, boolean isClasspathPath, Map<String, Object> params, Locale locale) Evaluates a template using the given parameters. Uses the specified Locale.- Parameters:
isClasspathPath
- iftrue
, the 'templatePath' is considered as a classpath's relative path. Iffalse
, it is considered as an absolute file system path.
-
fromTemplate
Evaluates a template using the parameters specified as aJsonObject
. Uses the default Locale.- Parameters:
isClasspathPath
- iftrue
, the 'templatePath' is considered as a classpath's relative path. Iffalse
, it is considered as an absolute file system path.
-
fromTemplate
String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject, Locale locale) Evaluates a template using the parameters specified as aJsonObject
. Uses the specified Locale.- Parameters:
isClasspathPath
- iftrue
, the 'templatePath' is considered as a classpath's relative path. Iffalse
, it is considered as an absolute file system path.
-
createPlaceholder
Creates a placeholder using the current templating engine implementation.This is mainly useful for the tests, which don't know in advance which templating engine will be used, so which syntax to use for the placeholders.
For example, using Pebble, a call to
createPlaceholder("name")
will result in "{{name}}
" (without the quotes).
-