public class SpincastPebbleTemplatingEngine extends Object implements TemplatingEngine
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
static String |
PEBBLE_PARAMS_AS_JSONOBJECT |
| Constructor and Description |
|---|
SpincastPebbleTemplatingEngine(SpincastConfig spincastConfig,
SpincastPebbleTemplatingEngineConfig spincastPebbleTemplatingEngineConfig,
SpincastPebbleExtension spincastPebbleExtension,
JsonManager jsonManager) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCommonLoaderFeatures(com.mitchellbosecke.pebble.PebbleEngine.Builder builder) |
String |
createPlaceholder(String variable)
Creates a placeholder using the current templating engine
implementation.
|
String |
evaluate(String content,
JsonObject jsonObject)
Evaluates the content, using the given parameters.
|
String |
evaluate(String content,
JsonObject jsonObject,
Locale locale)
Evaluates the content, using the given parameters.
|
String |
evaluate(String content,
Map<String,Object> params)
Evaluates the content, using the given parameters.
|
String |
evaluate(String content,
Map<String,Object> params,
Locale locale)
Evaluates the content, using the given parameters.
|
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject jsonObject)
Evaluates a template using the parameters specified
as a
JsonObject. |
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject jsonObject,
Locale locale)
Evaluates a template using the parameters specified
as a
JsonObject. |
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params)
Evaluates a template using the given parameters.
|
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
Locale locale)
Evaluates a template using the given parameters.
|
String |
fromTemplate(String templatePath,
JsonObject jsonObject)
Evaluates a template using the parameters specified
as a
JsonObject. |
String |
fromTemplate(String templatePath,
JsonObject jsonObject,
Locale locale)
Evaluates a template using the parameters specified
as a
JsonObject. |
String |
fromTemplate(String templatePath,
Map<String,Object> params)
Evaluates a template using the given parameters.
|
String |
fromTemplate(String templatePath,
Map<String,Object> params,
Locale locale)
Evaluates a template using the given parameters.
|
protected com.mitchellbosecke.pebble.loader.Loader<String> |
getClasspathTemplateLoader() |
protected com.mitchellbosecke.pebble.loader.Loader<String> |
getFileSystemTemplateLoader() |
protected JsonManager |
getJsonManager() |
protected com.mitchellbosecke.pebble.PebbleEngine |
getPebbleEngineString() |
protected com.mitchellbosecke.pebble.PebbleEngine |
getPebbleEngineTemplateClasspath() |
protected com.mitchellbosecke.pebble.PebbleEngine |
getPebbleEngineTemplateFileSystem() |
protected SpincastConfig |
getSpincastConfig() |
protected SpincastPebbleExtension |
getSpincastPebbleExtension() |
protected SpincastPebbleTemplatingEngineConfig |
getSpincastPebbleTemplatingEngineConfig() |
protected String |
parse(String htmlOrPath,
JsonObject paramsAsJsonObject,
Map<String,Object> params,
boolean isTemplate,
boolean isClasspathPath,
Locale locale) |
protected static final org.slf4j.Logger logger
public static final String PEBBLE_PARAMS_AS_JSONOBJECT
@Inject public SpincastPebbleTemplatingEngine(SpincastConfig spincastConfig, SpincastPebbleTemplatingEngineConfig spincastPebbleTemplatingEngineConfig, @Nullable SpincastPebbleExtension spincastPebbleExtension, JsonManager jsonManager)
protected SpincastConfig getSpincastConfig()
protected SpincastPebbleTemplatingEngineConfig getSpincastPebbleTemplatingEngineConfig()
protected SpincastPebbleExtension getSpincastPebbleExtension()
protected JsonManager getJsonManager()
protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineString()
protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineTemplateClasspath()
protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineTemplateFileSystem()
protected void addCommonLoaderFeatures(com.mitchellbosecke.pebble.PebbleEngine.Builder builder)
protected com.mitchellbosecke.pebble.loader.Loader<String> getClasspathTemplateLoader()
protected com.mitchellbosecke.pebble.loader.Loader<String> getFileSystemTemplateLoader()
public String evaluate(String content, JsonObject jsonObject)
TemplatingEngineJsonObject.
Uses the default Locale.evaluate in interface TemplatingEnginepublic String evaluate(String content, JsonObject jsonObject, Locale locale)
TemplatingEngineJsonObject.
Uses the specified Locale.evaluate in interface TemplatingEnginepublic String evaluate(String content, Map<String,Object> params)
TemplatingEngineevaluate in interface TemplatingEnginepublic String evaluate(String content, Map<String,Object> params, Locale locale)
TemplatingEngineevaluate in interface TemplatingEnginepublic String fromTemplate(String templatePath, JsonObject jsonObject)
TemplatingEngineJsonObject.
Uses the default Locale.fromTemplate in interface TemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, JsonObject jsonObject, Locale locale)
TemplatingEngineJsonObject.
Uses the specified Locale.fromTemplate in interface TemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject)
TemplatingEngineJsonObject.
Uses the default Locale.fromTemplate in interface TemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.public String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject, Locale locale)
TemplatingEngineJsonObject.
Uses the specified Locale.fromTemplate in interface TemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.public String fromTemplate(String templatePath, Map<String,Object> params)
TemplatingEnginefromTemplate in interface TemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, Map<String,Object> params, Locale locale)
TemplatingEnginefromTemplate in interface TemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params)
TemplatingEnginefromTemplate in interface TemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.public String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params, Locale locale)
TemplatingEnginefromTemplate in interface TemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.protected String parse(String htmlOrPath, JsonObject paramsAsJsonObject, Map<String,Object> params, boolean isTemplate, boolean isClasspathPath, Locale locale)
public String createPlaceholder(String variable)
TemplatingEngineThis 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).
createPlaceholder in interface TemplatingEngineCopyright © 2017. All rights reserved.