public abstract class AbstractContext extends Object implements IContext
Abstract base class for most IContext
implementations.
Note a class with this name existed since 1.0, but it was completely reimplemented in Thymeleaf 3.0
Modifier | Constructor and Description |
---|---|
protected |
AbstractContext() |
protected |
AbstractContext(Locale locale) |
protected |
AbstractContext(Locale locale,
Map<String,Object> variables) |
Modifier and Type | Method and Description |
---|---|
void |
clearVariables()
Removes all the variables from the context.
|
boolean |
containsVariable(String name)
Checks whether a specific variable is already contained in this context or not.
|
Locale |
getLocale()
Returns the locale that should be used for processing the template.
|
Object |
getVariable(String name)
Retrieve a specific variable, by name.
|
Set<String> |
getVariableNames()
Get a list with all the names of variables contained at this context.
|
void |
removeVariable(String name)
Removes a variable from the context.
|
void |
setLocale(Locale locale)
Sets the locale to be used.
|
void |
setVariable(String name,
Object value)
Sets a new variable into the context.
|
void |
setVariables(Map<String,Object> variables)
Sets several variables at a time into the context.
|
protected AbstractContext()
protected AbstractContext(Locale locale)
public final Locale getLocale()
IContext
Returns the locale that should be used for processing the template.
public final boolean containsVariable(String name)
IContext
Checks whether a specific variable is already contained in this context or not.
containsVariable
in interface IContext
name
- the name of the variable to be checked.public final Set<String> getVariableNames()
IContext
Get a list with all the names of variables contained at this context.
getVariableNames
in interface IContext
public final Object getVariable(String name)
IContext
Retrieve a specific variable, by name.
getVariable
in interface IContext
name
- the name of the variable to be retrieved.public void setLocale(Locale locale)
Sets the locale to be used.
locale
- the locale.public void setVariable(String name, Object value)
Sets a new variable into the context.
name
- the name of the variable.value
- the value of the variable.public void setVariables(Map<String,Object> variables)
Sets several variables at a time into the context.
variables
- the variables to be set.public void removeVariable(String name)
Removes a variable from the context.
name
- the name of the variable to be removed.public void clearVariables()
Removes all the variables from the context.
Copyright © 2017 The THYMELEAF team. All rights reserved.