public.javadoc.org.spincast.core.templating.TemplatingRequestContextAddon.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
TemplatingRequestContextAddon (org.spincast:spincast-framework 1.0.0 API)
org.spincast.core.templating
Interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
- All Known Implementing Classes:
- SpincastTemplatingRequestContextAddon
public interface TemplatingRequestContextAddon<R extends RequestContext<?>>
Provides methods to deal with templating.
-
-
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
void
addTemplatingGlobalVariable(String key,
Object value)
Adds a global variable that will be available to any following
evaluation by the templating engine.
void
addTemplatingGlobalVariables(Map<String,Object> variables)
Adds global variables that will be available to any following
evaluation by the templating engine.
String
createPlaceholder(String variable)
Creates a placeholder using the current templating engine
implementation.
void
deleteAllTemplatingGlobalVariables()
Deletes all global templating variables.
void
deleteTemplatingGlobalVariable(String key)
Deletes a global templating variable.
String
evaluate(String content)
Evaluates some content without any parameters.
String
evaluate(String content,
JsonObject model)
Evaluates some content using the given parameters.
String
evaluate(String content,
JsonObject model,
Locale locale)
Evaluates some content using the given parameters.
String
evaluate(String content,
Map<String,Object> params)
Evaluates some content using the given parameters.
String
evaluate(String content,
Map<String,Object> params,
Locale locale)
Evaluates some content using the given parameters.
String
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model)
Renders a template using the given parameters.
String
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model,
Locale locale)
Renders a template usgin the given parameters.
String
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params)
Renders a template using the given parameters.
String
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
Locale locale)
Renders a template usgin the given parameters.
String
fromTemplate(String templatePath,
JsonObject model)
Renders a template using the given parameters.
String
fromTemplate(String templatePath,
JsonObject model,
Locale locale)
Renders a template usgin the given parameters.
String
fromTemplate(String templatePath,
Map<String,Object> params)
Renders a template using the given parameters.
String
fromTemplate(String templatePath,
Map<String,Object> params,
Locale locale)
Renders a template usgin the given parameters.
Map<String,Object>
getSpincastReservedMap()
Gets the Map reserved for Spincast usage to put some
global templating variables.
Object
getTemplatingGlobalVariable(String key)
Gets a global templating variable.
Map<String,Object>
getTemplatingGlobalVariables()
The global templating variables.
-
-
Method Detail
-
addTemplatingGlobalVariable
void addTemplatingGlobalVariable(String key,
Object value)
Adds a global variable that will be available to any following
evaluation by the templating engine.
-
addTemplatingGlobalVariables
void addTemplatingGlobalVariables(Map<String,Object> variables)
Adds global variables that will be available to any following
evaluation by the templating engine.
-
getTemplatingGlobalVariables
Map<String,Object> getTemplatingGlobalVariables()
The global templating variables.
-
getTemplatingGlobalVariable
Object getTemplatingGlobalVariable(String key)
Gets a global templating variable.
-
deleteAllTemplatingGlobalVariables
void deleteAllTemplatingGlobalVariables()
Deletes all global templating variables.
-
deleteTemplatingGlobalVariable
void deleteTemplatingGlobalVariable(String key)
Deletes a global templating variable.
-
evaluate
String evaluate(String content,
Map<String,Object> params)
Evaluates some content using the given parameters.
Uses the Locale
found by the LocaleResolver
.
-
evaluate
String evaluate(String content,
Map<String,Object> params,
Locale locale)
Evaluates some content using the given parameters.
Uses the specified Locale
.
-
fromTemplate
String fromTemplate(String templatePath,
Map<String,Object> params)
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
String fromTemplate(String templatePath,
Map<String,Object> params,
Locale locale)
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
String fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params)
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Parameters:
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
fromTemplate
String fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
Locale locale)
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Parameters:
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
evaluate
String evaluate(String content)
Evaluates some content without any parameters.
Uses the Locale
found by the LocaleResolver
.
-
evaluate
String evaluate(String content,
JsonObject model)
Evaluates some content using the given parameters.
Uses the Locale
found by the LocaleResolver
.
-
evaluate
String evaluate(String content,
JsonObject model,
Locale locale)
Evaluates some content using the given parameters.
Uses the specified Locale
.
-
fromTemplate
String fromTemplate(String templatePath,
JsonObject model)
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
String fromTemplate(String templatePath,
JsonObject model,
Locale locale)
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
String fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model)
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Parameters:
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
fromTemplate
String fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model,
Locale locale)
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Parameters:
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
createPlaceholder
String createPlaceholder(String variable)
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).
Copyright © 2019. All rights reserved.