public Object execute( final IExpressionContext context) { return execute(context, StandardExpressionExecutionContext.NORMAL); }
static Object executeDefault( final IExpressionContext context, final DefaultExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating default expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object queriedValue = expression.getQueriedExpression().execute(context, expContext); if (queriedValue == null) { return expression.getDefaultExpression().execute(context, expContext); } return queriedValue; }
static Object executeConditional( final IExpressionContext context, final ConditionalExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating conditional expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object condObj = expression.getConditionExpression().execute(context, expContext); final boolean cond = EvaluationUtils.evaluateAsBoolean(condObj); if (cond) { return expression.getThenExpression().execute(context, expContext); } return expression.getElseExpression().execute(context, expContext); }
static Object executeNegation( final IExpressionContext context, final NegationExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating negation expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object operandValue = expression.getOperand().execute(context, expContext); final boolean operandBooleanValue = EvaluationUtils.evaluateAsBoolean(operandValue); return Boolean.valueOf(!operandBooleanValue); }
static Object executeMinus( final IExpressionContext context, final MinusExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating minus expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } Object operandValue = expression.getOperand().execute(context, expContext); if (operandValue == null) { operandValue = "null"; } final BigDecimal operandNumberValue = EvaluationUtils.evaluateAsNumber(operandValue); if (operandNumberValue != null) { // Addition will act as a mathematical 'plus' return operandNumberValue.multiply(BigDecimal.valueOf(-1)); } throw new TemplateProcessingException( "Cannot execute minus: operand is \"" + LiteralValue.unwrap(operandValue) + "\""); }
public Object execute( final IExpressionContext context, final StandardExpressionExecutionContext expContext) { Validate.notNull(context, "Context cannot be null"); final IStandardVariableExpressionEvaluator variableExpressionEvaluator = StandardExpressions.getVariableExpressionEvaluator(context.getConfiguration()); final Object result = execute(context, this, variableExpressionEvaluator, expContext); return LiteralValue.unwrap(result); }
if (leftExpr instanceof Expression) { leftValue = Expression.execute(context, (Expression)leftExpr, expressionEvaluator, expContext); } else{ leftValue = leftExpr.execute(context, expContext); if (rightExpr instanceof Expression) { rightValue = Expression.execute(context, (Expression)rightExpr, expressionEvaluator, expContext); } else{ rightValue = rightExpr.execute(context, expContext);
public Object execute(final Configuration configuration, final IProcessingContext processingContext) { return execute(configuration, processingContext, StandardExpressionExecutionContext.NORMAL); }
/** * @since 2.0.16 * @deprecated the StandardExpressionProcessor class was deprecated in 2.1.0 for semantic and refactoring reasons. * Should use the equivalent {@link StandardExpressions} instead if you want to obtain * parser instances registered by the standard dialects, or instance your * parser instances using their constructors directly if you are building your own dialect * including these parserss. As for expression execution, this is no longer managed by executor * objects (also deprecated) but by the expressions themselves. Will be removed in 3.0. */ @Deprecated public static Object executeExpression(final Configuration configuration, final IProcessingContext processingContext, final Expression expression, final StandardExpressionExecutionContext expContext) { return expression.execute(configuration, processingContext, expContext); }
/** * @deprecated The StandardExpressionExecutor class has been deprecated in 2.1.0. Instead the "execute()" methods * in Expression objects returned by parsers should be used directly. */ @Deprecated public Object executeExpression(final Configuration configuration, final IProcessingContext processingContext, final Expression expression) { Validate.notNull(expression, "Expression cannot be null"); return expression.execute(configuration, processingContext, StandardExpressionExecutionContext.NORMAL); }
/** * @since 2.0.16 * @deprecated The StandardExpressionExecutor class has been deprecated in 2.1.0. Instead the "execute()" methods * in Expression objects returned by parsers should be used directly. */ @Deprecated public Object executeExpression(final Configuration configuration, final IProcessingContext processingContext, final Expression expression, final StandardExpressionExecutionContext expContext) { Validate.notNull(expression, "Expression cannot be null"); return expression.execute(configuration, processingContext, expContext); }
/** * @since 2.0.9 * @deprecated the StandardExpressionProcessor class was deprecated in 2.1.0 for semantic and refactoring reasons. * Should use the equivalent {@link StandardExpressions} instead if you want to obtain * parser instances registered by the standard dialects, or instance your * parser instances using their constructors directly if you are building your own dialect * including these parserss. As for expression execution, this is no longer managed by executor * objects (also deprecated) but by the expressions themselves. Will be removed in 3.0. */ @Deprecated public static Object processExpression(final Configuration configuration, final IProcessingContext processingContext, final String input) { final Expression expression = parseExpression(configuration, processingContext, input); return expression.execute(configuration, processingContext); }
static Object executeDefault(final Configuration configuration, final IProcessingContext processingContext, final DefaultExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating default expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object queriedValue = expression.getQueriedExpression().execute(configuration, processingContext, expContext); if (queriedValue == null) { return expression.getDefaultExpression().execute(configuration, processingContext, expContext); } return queriedValue; }
static Object executeConditional(final Configuration configuration, final IProcessingContext processingContext, final ConditionalExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating conditional expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object condObj = expression.getConditionExpression().execute(configuration, processingContext, expContext); final boolean cond = EvaluationUtil.evaluateAsBoolean(condObj); if (cond) { return expression.getThenExpression().execute(configuration, processingContext, expContext); } return expression.getElseExpression().execute(configuration, processingContext, expContext); }
/** * @deprecated the StandardExpressionProcessor class was deprecated in 2.1.0 for semantic and refactoring reasons. * Should use the equivalent {@link StandardExpressions} instead if you want to obtain * parser instances registered by the standard dialects, or instance your * parser instances using their constructors directly if you are building your own dialect * including these parserss. As for expression execution, this is no longer managed by executor * objects (also deprecated) but by the expressions themselves. Will be removed in 3.0. */ @Deprecated public static Object executeExpression(final Arguments arguments, final Expression expression) { Validate.notNull(arguments, "Arguments cannot be null"); return expression.execute(arguments.getConfiguration(), arguments); }
/** * @since 2.0.16 * @deprecated The StandardExpressionExecutor class has been deprecated in 2.1.0. Instead the "execute()" methods * in Expression objects returned by parsers should be used directly. */ @Deprecated public Object executeExpression(final Arguments arguments, final Expression expression, final StandardExpressionExecutionContext expContext) { Validate.notNull(arguments, "Arguments cannot be null"); Validate.notNull(expression, "Expression cannot be null"); return expression.execute(arguments.getConfiguration(), arguments, expContext); }
static Object executeNegation(final Configuration configuration, final IProcessingContext processingContext, final NegationExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating negation expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object operandValue = expression.getOperand().execute(configuration, processingContext, expContext); final boolean operandBooleanValue = EvaluationUtil.evaluateAsBoolean(operandValue); return Boolean.valueOf(!operandBooleanValue); }
/** * * @deprecated The StandardExpressionExecutor class has been deprecated in 2.1.0. Instead the "execute()" methods * in Expression objects returned by parsers should be used directly. */ @Deprecated public Object executeExpression(final Arguments arguments, final Expression expression) { Validate.notNull(arguments, "Arguments cannot be null"); Validate.notNull(expression, "Expression cannot be null"); return expression.execute(arguments.getConfiguration(), arguments, StandardExpressionExecutionContext.NORMAL); }
/** * @deprecated the StandardExpressionProcessor class was deprecated in 2.1.0 for semantic and refactoring reasons. * Should use the equivalent {@link StandardExpressions} instead if you want to obtain * parser instances registered by the standard dialects, or instance your * parser instances using their constructors directly if you are building your own dialect * including these parserss. As for expression execution, this is no longer managed by executor * objects (also deprecated) but by the expressions themselves. Will be removed in 3.0. */ @Deprecated public static Object processExpression(final Arguments arguments, final String input) { Validate.notNull(arguments, "Arguments cannot be null"); final Expression expression = parseExpression(arguments, input); return expression.execute(arguments.getConfiguration(), arguments); }
public Object execute(final Configuration configuration, final IProcessingContext processingContext, final StandardExpressionExecutionContext expContext) { Validate.notNull(configuration, "Configuration cannot be null"); Validate.notNull(processingContext, "Processing context cannot be null"); final IStandardVariableExpressionEvaluator variableExpressionEvaluator = StandardExpressions.getVariableExpressionEvaluator(configuration); final Object result = execute(configuration, processingContext, this, variableExpressionEvaluator, expContext); return LiteralValue.unwrap(result); }