Class ExpressionProcessor
- java.lang.Object
-
- nz.net.ultraq.thymeleaf.expressionprocessor.ExpressionProcessor
-
public class ExpressionProcessor extends Object
A simplified API for working with Thymeleaf expressions.- Author:
- zhanhb, Emanuel Rabina
-
-
Constructor Summary
Constructors Constructor Description ExpressionProcessor(IExpressionContext context)Constructor, sets the execution context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IExpressionContextgetContext()IStandardExpressionparse(String expression)Parses an expression, returning the matching expression type.FragmentExpressionparseFragmentExpression(String expression)Parses an expression under the assumption it is a fragment expression.Objectprocess(String expression)Parse and executes an expression, returning whatever the type of the expression result is.StringprocessAsString(String expression)Parse and execute an expression, returning the result as a string.
-
-
-
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.
-
getContext
public final IExpressionContext getContext()
-
-