Example usage for org.springframework.expression EvaluationException EvaluationException

List of usage examples for org.springframework.expression EvaluationException EvaluationException

Introduction

In this page you can find the example usage for org.springframework.expression EvaluationException EvaluationException.

Prototype

public EvaluationException(String message) 

Source Link

Document

Create a new expression evaluation exception.

Usage

From source file:fr.acxio.tools.agia.expression.StandardDataExpressionResolver.java

@Override
public <T> T evaluate(String sExpression, EvaluationContext sEvalContext, Class<T> sTargetType) {
    if (!StringUtils.hasLength(sExpression)) {
        if (sTargetType == null || ClassUtils.isAssignableValue(sTargetType, sExpression)) {
            return (T) sExpression;
        }//  w  w  w.j a va2 s.c o m
        throw new EvaluationException(
                "Cannot convert value '" + sExpression + "' to type '" + sTargetType.getName() + "'");
    }
    try {
        Expression expr = this.expressionCache.get(sExpression);
        if (expr == null) {
            expr = this.expressionParser.parseExpression(sExpression, expressionParserContext);
            this.expressionCache.put(sExpression, expr);
        }
        return expr.getValue(sEvalContext, sTargetType);
    } catch (Exception ex) {
        throw new EvaluationException("Expression parsing failed", ex);
    }
}