Class 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
    • Constructor Detail

      • StandardDialect

        public StandardDialect()
      • StandardDialect

        protected StandardDialect​(String name,
                                  String prefix,
                                  int processorPrecedence)
    • 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.
      • 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.
      • 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.
      • 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.
      • 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.