Package org.springframework.expression

Examples of org.springframework.expression.Expression


  /**
   *
   */
  public final boolean applies(String condition) {
    if (condition != null) {
      Expression expr = parser.parseExpression(condition);
      Object value = expr.getValue(evalContext);
      if (value instanceof Boolean) {
        return (Boolean) value;
      }
      throw new JibeRuntimeException("Wrong value returned:" + condition);
    }
View Full Code Here


    StandardEvaluationContext context = new StandardEvaluationContext();
    context.setRootObject(new Object());
    context.addMethodResolver(new ConditionEvalMethodResolver());
    ExpressionParser parser = new SpelExpressionParser();

    Expression exp = parser.parseExpression("test('test') or paet(true)");
    System.out.println(exp.getValue(context));

  }
View Full Code Here

  @Test
  public void test1() {
    System.out.println(new Date().toString());
    ExpressionParser parser = new SpelExpressionParser();
   
    Expression exp = parser.parseExpression("date");
    TestBean b = new TestBean();
    exp.setValue(b, "Sat Nov 20 10:52:05 CET 2010");

    System.out.println(b.getInn().getVal());
  }
View Full Code Here

    PartitionKeyMethodResolver resolver = new PartitionKeyMethodResolver();
    MessagePartitionKeyPropertyAccessor accessor = new MessagePartitionKeyPropertyAccessor();
    context.addMethodResolver(resolver);
    context.addPropertyAccessor(accessor);

    Expression expression1 = parser.parseExpression("payload");
    Expression expression2 = parser.parseExpression("timestamp");
    for (int i = 0; i<1000000; i++) {
      expression1.getValue(context, message, String.class);
      expression2.getValue(context, message, Long.class);
    }
  }
View Full Code Here

    Message<String> message = MessageBuilder.withPayload("jee").build();

    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();

    Expression expression1 = parser.parseExpression("payload");
    Expression expression2 = parser.parseExpression("headers.timestamp");
    for (int i = 0; i<1000000; i++) {
      expression1.getValue(context, message, String.class);
      expression2.getValue(context, message, Long.class);
    }
  }
View Full Code Here

                        accessExpression.substring(2, accessExpression.length() - 1) :
                        accessExpression);
       
        final WebSecurityExpressionHandler handler = getExpressionHandler(servletContext);

        Expression expressionObject = null;
        try {
            expressionObject = handler.getExpressionParser().parseExpression(expr);
        } catch (ParseException e) {
            throw new TemplateProcessingException(
                    "An error happened trying to parse Spring Security access expression \""
View Full Code Here

   * @see org.springframework.data.mapping.model.SpELExpressionEvaluator#evaluate(java.lang.String)
   */
  @SuppressWarnings("unchecked")
  public <T> T evaluate(String expression) {

    Expression parseExpression = factory.getParser().parseExpression(expression);
    return (T) parseExpression.getValue(factory.getEvaluationContext(source));
  }
View Full Code Here

   public Object retrieveValue(String expression) throws UnsupportedOperationException
   {

      try {

         Expression exp = parser.parseExpression(expression);
         return exp.getValue(getEvaluationContext());

      }
      catch (SpelEvaluationException e) {
         throw new IllegalArgumentException(e);
      }
View Full Code Here

   public void submitValue(String expression, Object value) throws UnsupportedOperationException
   {

      try {

         Expression exp = parser.parseExpression(expression);
         exp.setValue(getEvaluationContext(), value);

      }
      catch (SpelEvaluationException e) {
         throw new IllegalArgumentException(e);
      }
View Full Code Here

         if (!el.endsWith("()")) {
            el = el + "()";
         }

         // evaluate the expression
         Expression exp = parser.parseExpression(el);
         return exp.getValue(getEvaluationContext());

      }
      catch (SpelEvaluationException e) {
         throw new UnsupportedOperationException(e);
      }
View Full Code Here

TOP

Related Classes of org.springframework.expression.Expression

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.