Class StandardDialect
- Object
-
- org.thymeleaf.dialect.AbstractDialect
-
- org.thymeleaf.dialect.AbstractProcessorDialect
-
- org.thymeleaf.standard.StandardDialect
-
- All Implemented Interfaces:
IDialect
,IExecutionAttributeDialect
,IExpressionObjectDialect
,IProcessorDialect
public class StandardDialect extends AbstractProcessorDialect implements IExecutionAttributeDialect, IExpressionObjectDialect
Standard Dialect. This is the class containing the implementation of Thymeleaf Standard Dialect, including all
th:*
processors, expression objects, etc.Note this dialect uses OGNL as an expression language. There is a Spring-integrated version of the Standard Dialect called the SpringStandard Dialect at the
thymeleaf-spring*
packages, which uses SpringEL as an expression language.Note a class with this name existed since 1.0, but it was completely reimplemented in Thymeleaf 3.0
- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME
static String
PREFIX
static int
PROCESSOR_PRECEDENCE
-
Constructor Summary
Constructors Modifier Constructor Description StandardDialect()
protected
StandardDialect(String name, String prefix, int processorPrecedence)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Set<IProcessor>
createStandardProcessorsSet(String dialectPrefix)
Create a the set of Standard processors, all of them freshly instanced.IStandardConversionService
getConversionService()
Returns the Standard Conversion Service (implementation ofIStandardConversionService
) that is configured to be used at this instance of the Standard Dialect.IStandardCSSSerializer
getCSSSerializer()
Returns the Standard CSS Serializer (implementation ofIStandardCSSSerializer
) that is configured to be used at this instance of the Standard Dialect.Map<String,Object>
getExecutionAttributes()
IExpressionObjectFactory
getExpressionObjectFactory()
IStandardExpressionParser
getExpressionParser()
Returns the Thymeleaf Standard Expression parser (implementation ofIStandardExpressionParser
) that is configured to be used at this instance of the Standard Dialect.IStandardJavaScriptSerializer
getJavaScriptSerializer()
Returns the Standard JavaScript Serializer (implementation ofIStandardJavaScriptSerializer
) that is configured to be used at this instance of the Standard Dialect.Set<IProcessor>
getProcessors(String dialectPrefix)
IStandardVariableExpressionEvaluator
getVariableExpressionEvaluator()
Returns the variable expression evaluator (implementation ofIStandardVariableExpressionEvaluator
) that is configured to be used at this instance of the Standard Dialect.void
setConversionService(IStandardConversionService conversionService)
Sets the Standard Conversion Service (implementation ofIStandardConversionService
) that should to be used at this instance of the Standard Dialect.void
setCSSSerializer(IStandardCSSSerializer cssSerializer)
Sets the Standard CSS Serializer (implementation ofIStandardCSSSerializer
) that should to be used at this instance of the Standard Dialect.void
setExpressionParser(IStandardExpressionParser expressionParser)
Sets the Thymeleaf Standard Expression parser (implementation ofIStandardExpressionParser
) that should be used at this instance of the Standard Dialect.void
setJavaScriptSerializer(IStandardJavaScriptSerializer javaScriptSerializer)
Sets the Standard JavaScript Serializer (implementation ofIStandardJavaScriptSerializer
) that should to be used at this instance of the Standard Dialect.void
setVariableExpressionEvaluator(IStandardVariableExpressionEvaluator variableExpressionEvaluator)
Sets the variable expression evaluator (implementation ofIStandardVariableExpressionEvaluator
) that should be used at this instance of the Standard Dialect.-
Methods inherited from class org.thymeleaf.dialect.AbstractProcessorDialect
getDialectProcessorPrecedence, getPrefix
-
Methods inherited from class org.thymeleaf.dialect.AbstractDialect
getName
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
PREFIX
public static final String PREFIX
- See Also:
- Constant Field Values
-
PROCESSOR_PRECEDENCE
public static final int PROCESSOR_PRECEDENCE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVariableExpressionEvaluator
public IStandardVariableExpressionEvaluator getVariableExpressionEvaluator()
Returns the variable expression evaluator (implementation of
IStandardVariableExpressionEvaluator
) that is configured to be used at this instance of the Standard Dialect.This is used for executing all ${...} and *{...} expressions in Thymeleaf Standard Expressions.
This will be
OGNLVariableExpressionEvaluator
by default. When using the Spring Standard Dialect, this will be a SpringEL-based implementation.- Returns:
- the Standard Variable Expression Evaluator object.
-
setVariableExpressionEvaluator
public void setVariableExpressionEvaluator(IStandardVariableExpressionEvaluator variableExpressionEvaluator)
Sets the variable expression evaluator (implementation of
IStandardVariableExpressionEvaluator
) that should be used at this instance of the Standard Dialect.This is used for executing all ${...} and *{...} expressions in Thymeleaf Standard Expressions.
This will be an
OGNLVariableExpressionEvaluator
by default. When using the Spring Standard Dialect, this will be a SpringEL-based implementation.This method has no effect once the Template Engine has been initialized.
Objects set here should be thread-safe.
- Parameters:
variableExpressionEvaluator
- the new Standard Variable Expression Evaluator object. Cannot be null.
-
getExpressionParser
public IStandardExpressionParser getExpressionParser()
Returns the Thymeleaf Standard Expression parser (implementation of
IStandardExpressionParser
) that is configured to be used at this instance of the Standard Dialect.This will be
StandardExpressionParser
by default.- Returns:
- the Standard Expression Parser object.
-
setExpressionParser
public void setExpressionParser(IStandardExpressionParser expressionParser)
Sets the Thymeleaf Standard Expression parser (implementation of
IStandardExpressionParser
) that should be used at this instance of the Standard Dialect.This will be
StandardExpressionParser
by default.This method has no effect once the Template Engine has been initialized.
Objects set here should be thread-safe.
- Parameters:
expressionParser
- the Standard Expression Parser object to be used. Cannot be null.
-
getConversionService
public IStandardConversionService getConversionService()
Returns the Standard Conversion Service (implementation of
IStandardConversionService
) that is configured to be used at this instance of the Standard Dialect.This will be
StandardConversionService
by default. In Spring environments, this will default to an implementation delegating on Spring's own ConversionService implementation.- Returns:
- the Standard Conversion Service object.
-
setConversionService
public void setConversionService(IStandardConversionService conversionService)
Sets the Standard Conversion Service (implementation of
IStandardConversionService
) that should to be used at this instance of the Standard Dialect.This will be
StandardConversionService
by default. In Spring environments, this will default to an implementation delegating on Spring's own ConversionService implementation.This method has no effect once the Template Engine has been initialized.
Objects set here should be thread-safe.
- Parameters:
conversionService
- the Standard ConversionService object to be used. Cannot be null.
-
getJavaScriptSerializer
public IStandardJavaScriptSerializer getJavaScriptSerializer()
Returns the Standard JavaScript Serializer (implementation of
IStandardJavaScriptSerializer
) that is configured to be used at this instance of the Standard Dialect.This will be
StandardJavaScriptSerializer
by default.- Returns:
- the Standard JavaScript Serializer object.
-
setJavaScriptSerializer
public void setJavaScriptSerializer(IStandardJavaScriptSerializer javaScriptSerializer)
Sets the Standard JavaScript Serializer (implementation of
IStandardJavaScriptSerializer
) that should to be used at this instance of the Standard Dialect.This will be
StandardJavaScriptSerializer
by default.This method has no effect once the Template Engine has been initialized.
Objects set here should be thread-safe.
- Parameters:
javaScriptSerializer
- the Standard JavaScript Serializer object to be used. Cannot be null.
-
getCSSSerializer
public IStandardCSSSerializer getCSSSerializer()
Returns the Standard CSS Serializer (implementation of
IStandardCSSSerializer
) that is configured to be used at this instance of the Standard Dialect.This will be
StandardCSSSerializer
by default.- Returns:
- the Standard CSS Serializer object.
-
setCSSSerializer
public void setCSSSerializer(IStandardCSSSerializer cssSerializer)
Sets the Standard CSS Serializer (implementation of
IStandardCSSSerializer
) that should to be used at this instance of the Standard Dialect.This will be
StandardCSSSerializer
by default.This method has no effect once the Template Engine has been initialized.
Objects set here should be thread-safe.
- Parameters:
cssSerializer
- the Standard CSS Serializer object to be used. Cannot be null.
-
getExecutionAttributes
public Map<String,Object> getExecutionAttributes()
- Specified by:
getExecutionAttributes
in interfaceIExecutionAttributeDialect
-
getExpressionObjectFactory
public IExpressionObjectFactory getExpressionObjectFactory()
- Specified by:
getExpressionObjectFactory
in interfaceIExpressionObjectDialect
-
getProcessors
public Set<IProcessor> getProcessors(String dialectPrefix)
- Specified by:
getProcessors
in interfaceIProcessorDialect
-
createStandardProcessorsSet
public static Set<IProcessor> createStandardProcessorsSet(String dialectPrefix)
Create a the set of Standard processors, all of them freshly instanced.
- Parameters:
dialectPrefix
- the prefix established for the Standard Dialect, needed for initialization- Returns:
- the set of Standard processors.
-
-