Package org.springframework.expression

Examples of org.springframework.expression.ExpressionParser


   */
  public static String spelParser(String expressionStr,
      Map<String, Object> params, ParserContext parserContext) {
    StandardEvaluationContext context = new StandardEvaluationContext(
        params);
    ExpressionParser spel = new SpelExpressionParser();
    return spel.parseExpression(expressionStr, parserContext).getValue(
        context, String.class);
  }// ;
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public Tuple select(String expression) {
    EvaluationContext context = new StandardEvaluationContext(toMap());
    ExpressionParser parser = new SpelExpressionParser();
    Expression exp = parser.parseExpression(expression);

    // TODO test instance is a map
    Object result = exp.getValue(context);
    Map<String, Object> resultMap = null;
    if (ClassUtils.isAssignableValue(Map.class, result)) {
View Full Code Here

    return expression.getValue(evaluationContext, beanFactory);
  }

  private Expression parseExpression(String input) {
    if (StringUtils.hasText(input)) {
      ExpressionParser parser = new SpelExpressionParser();
      try {
        return parser.parseExpression(input);
      } catch (ParseException e) {
        throw new IllegalArgumentException("Cannot parse expression: " + input, e);
      }

    } else {
View Full Code Here

    @Override
    public String print(Object object, Locale locale) {
        if (spelExpression == null) {
            return null;
        }
        ExpressionParser parser = new SpelExpressionParser();
        try {
            Object result = parser.parseExpression(spelExpression).getValue(evaluationContext, object);
            return result.toString();
        } catch (SpelParseException e) {
            throw new CustomFormatException("Could not parse spel expression = \"" + spelExpression + "\" in " + CustomFormat.class.getSimpleName() + " annotation: " + e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.expression.ExpressionParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.