|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Objectorg.thymeleaf.context.AbstractContext
public abstract class AbstractContext
Abstract class for IContext implementations, providing some of the
features required to implement this interface.
| Field Summary | |
|---|---|
static String |
EXEC_INFO_VARIABLE_NAME
Name of the variable containing the "execution info" object. |
| Constructor Summary | |
|---|---|
protected |
AbstractContext()
Create an instance without specifying a locale. |
protected |
AbstractContext(Locale locale)
Create an instance specifying a locale. |
protected |
AbstractContext(Locale locale,
Map<String,?> variables)
Create an instance specifying a locale and an initial set of context variables. |
| Method Summary | |
|---|---|
void |
addContextExecutionInfo(String templateName)
Adds the context execution info to the variables map. |
protected abstract IContextExecutionInfo |
buildContextExecutionInfo(String templateName)
Creates the specific instance of IContextExecutionInfo to be added
to the context as the execInfo variable. |
void |
clearVariables()
Removes from the map all the context variables currently set. |
Locale |
getLocale()
Returns the locale that will be used for template execution. |
VariablesMap<String,Object> |
getVariables()
Returns the VariablesMap object containing the variables that will be
available for the execution of expressions inside templates. |
void |
setLocale(Locale locale)
Set the locale to be used for template execution. |
void |
setVariable(String name,
Object value)
Adds a variable to the current set of context variables. |
void |
setVariables(Map<String,?> additionalVariables)
Adds a set of variables to the current set of context variables. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String EXEC_INFO_VARIABLE_NAME
Name of the variable containing the "execution info" object.
| Constructor Detail |
|---|
protected AbstractContext()
Create an instance without specifying a locale. Using this constructor, the default locale (Locale.getDefault()) will be used.
protected AbstractContext(Locale locale)
Create an instance specifying a locale.
locale - the locale to be used.
protected AbstractContext(Locale locale,
Map<String,?> variables)
Create an instance specifying a locale and an initial set of context variables.
locale - the locale to be used.variables - the initial set of context variables.| Method Detail |
|---|
public Locale getLocale()
IContextReturns the locale that will be used for template execution. This locale will determine the language of the externalized messages resolved by the message resolvers.
getLocale in interface IContextpublic void setLocale(Locale locale)
Set the locale to be used for template execution.
The locale specified using this method overrides the one that might have been set using a constructor.
locale - the locale to be set.public final VariablesMap<String,Object> getVariables()
IContext
Returns the VariablesMap object containing the variables that will be
available for the execution of expressions inside templates.
getVariables in interface IContext
public final void setVariable(String name,
Object value)
Adds a variable to the current set of context variables.
name - the name of the variable.value - the value of the variable.public final void setVariables(Map<String,?> additionalVariables)
Adds a set of variables to the current set of context variables.
additionalVariables - the new variables to be added.public final void clearVariables()
Removes from the map all the context variables currently set.
public final void addContextExecutionInfo(String templateName)
Adds the context execution info to the variables map.
This IContext implementation adds an object of the
ContextExecutionInfo class with variable name execInfo.
addContextExecutionInfo in interface IContexttemplateName - the name of the template being executedprotected abstract IContextExecutionInfo buildContextExecutionInfo(String templateName)
Creates the specific instance of IContextExecutionInfo to be added
to the context as the execInfo variable.
templateName - the name of the template being executed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||