@Deprecated public static List<Object> evaluateAsList(final Object value) { return EvaluationUtils.evaluateAsList(value); }
@Deprecated public static BigDecimal evaluateAsNumber(final Object object) { return EvaluationUtils.evaluateAsNumber(object); }
@Deprecated public static Object[] evaluateAsArray(final Object value) { return EvaluationUtils.evaluateAsArray(value); }
@Deprecated public static boolean evaluateAsBoolean(final Object condition) { return EvaluationUtils.evaluateAsBoolean(condition); }
/** * * @param condition condition * @return the result * @deprecated since 2.1, you should use the * {@link org.thymeleaf.standard.expression.IStandardConversionService} implementation * corresponding to the dialect you are using or the methods in * {@link EvaluationUtils}. * Will be removed in 3.0. */ @Deprecated public static boolean evaluateAsBoolean(final Object condition) { return EvaluationUtils.evaluateAsBoolean(condition); }
/** * * @param object object * @return the result * @deprecated since 2.1, you should use the * {@link org.thymeleaf.standard.expression.IStandardConversionService} implementation * corresponding to the dialect you are using or the methods in * {@link EvaluationUtils}. * Will be removed in 3.0. */ @Deprecated public static BigDecimal evaluateAsNumber(final Object object) { return EvaluationUtils.evaluateAsNumber(object); }
/** * * @param value value * @return the result * @deprecated since 2.1, you should use the * {@link org.thymeleaf.standard.expression.IStandardConversionService} implementation * corresponding to the dialect you are using or the methods in * {@link EvaluationUtils}. * Will be removed in 3.0. */ @Deprecated public static List<Object> convertToIterable(final Object value) { return EvaluationUtils.evaluateAsList(value); }
public Boolean isFalse(final Object target) { return Boolean.valueOf(!EvaluationUtils.evaluateAsBoolean(target)); }
/** * * @param value value * @return the result * @deprecated since 2.1, you should use the * {@link org.thymeleaf.standard.expression.IStandardConversionService} implementation * corresponding to the dialect you are using or the methods in * {@link EvaluationUtils}. * Will be removed in 3.0. */ @Deprecated public static Object[] convertToArray(final Object value) { return EvaluationUtils.evaluateAsArray(value); }
null : EvaluationUtils.evaluateAsNumber(year)); final BigDecimal nMonth = (month == null? null : EvaluationUtils.evaluateAsNumber(month)); final BigDecimal nDay = (day == null? null : EvaluationUtils.evaluateAsNumber(day)); final BigDecimal nHour = (hour == null? null : EvaluationUtils.evaluateAsNumber(hour)); final BigDecimal nMinute = (minute == null? null : EvaluationUtils.evaluateAsNumber(minute)); final BigDecimal nSecond = (second == null? null : EvaluationUtils.evaluateAsNumber(second)); final BigDecimal nMillisecond = (millisecond == null? null : EvaluationUtils.evaluateAsNumber(millisecond));
/** * * @param value value * @return the result * @deprecated since 2.1, you should use the * {@link org.thymeleaf.standard.expression.IStandardConversionService} implementation * corresponding to the dialect you are using or the methods in * {@link EvaluationUtils}. * Will be removed in 3.0. */ @Deprecated public static List<Object> convertToList(final Object value) { if (value == null) { // This mimics the old behaviour of the deprecated convertToList() method, which is not the same // as the current EvaluationUtils.convertToList() method. return Collections.singletonList(null); } return EvaluationUtils.evaluateAsList(value); }
public Boolean isTrue(final Object target) { return Boolean.valueOf(EvaluationUtils.evaluateAsBoolean(target)); }
final BigDecimal leftNumberValue = EvaluationUtils.evaluateAsNumber(leftValue); final BigDecimal rightNumberValue = EvaluationUtils.evaluateAsNumber(rightValue);
public static List<Object> evaluateAsIterable(ITemplateContext arguments, String rawValue) throws TemplateProcessingException { notNull(arguments, "arguments must not be null"); notEmpty(rawValue, "rawValue must not be empty"); final Object evaluatedExpression = evaluateExpression(arguments, rawValue); return EvaluationUtils.evaluateAsList(evaluatedExpression); }
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); }
final BigDecimal leftNumberValue = EvaluationUtils.evaluateAsNumber(leftValue); final BigDecimal rightNumberValue = EvaluationUtils.evaluateAsNumber(rightValue);
public static List<Object> evaluateAsIterable(ITemplateContext arguments, String rawValue) throws TemplateProcessingException { notNull(arguments, "arguments must not be null"); notEmpty(rawValue, "rawValue must not be empty"); final Object evaluatedExpression = evaluateExpression(arguments, rawValue); return EvaluationUtils.evaluateAsList(evaluatedExpression); }
static Object executeOr( final IExpressionContext context, final OrExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating OR expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object leftValue = expression.getLeft().execute(context, expContext); // Short circuit final boolean leftBooleanValue = EvaluationUtils.evaluateAsBoolean(leftValue); if (leftBooleanValue) { return Boolean.TRUE; } final Object rightValue = expression.getRight().execute(context, expContext); final boolean rightBooleanValue = EvaluationUtils.evaluateAsBoolean(rightValue); return Boolean.valueOf(rightBooleanValue); }
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) + "\""); }
static Object executeAnd( final IExpressionContext context, final AndExpression expression, final StandardExpressionExecutionContext expContext) { if (logger.isTraceEnabled()) { logger.trace("[THYMELEAF][{}] Evaluating AND expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation()); } final Object leftValue = expression.getLeft().execute(context, expContext); // Short circuit final boolean leftBooleanValue = EvaluationUtils.evaluateAsBoolean(leftValue); if (!leftBooleanValue) { return Boolean.FALSE; } final Object rightValue = expression.getRight().execute(context, expContext); final boolean rightBooleanValue = EvaluationUtils.evaluateAsBoolean(rightValue); return Boolean.valueOf(rightBooleanValue); }