Class ExpressionProcessor


  • public class ExpressionProcessor
    extends Object
    A simplified API for working with Thymeleaf expressions.
    Author:
    zhanhb, Emanuel Rabina
    • Constructor Detail

      • ExpressionProcessor

        public ExpressionProcessor​(IExpressionContext context)
        Constructor, sets the execution context.
        Parameters:
        context -
    • Method Detail

      • parse

        public IStandardExpression parse​(String expression)
        Parses an expression, returning the matching expression type.
        Parameters:
        expression -
        Returns:
        Matching expression type.
      • parseFragmentExpression

        public FragmentExpression parseFragmentExpression​(String expression)
        Parses an expression under the assumption it is a fragment expression. This method will wrap fragment expressions written in Thymeleaf 2 syntax as a backwards compatibility measure for those migrating their web apps to Thymeleaf 3. (This is because Thymeleaf 3 currently does the same, but expect this method to go away when Thymeleaf starts enforcing the new fragment expression syntax itself.)
        Parameters:
        expression -
        Returns:
        A fragment expression.
      • process

        public Object process​(String expression)
        Parse and executes an expression, returning whatever the type of the expression result is.
        Parameters:
        expression -
        Returns:
        The result of the expression being executed.
      • processAsString

        public String processAsString​(String expression)
        Parse and execute an expression, returning the result as a string. Useful for expressions that expect a simple result.
        Parameters:
        expression -
        Returns:
        The expression as a string.