Package org.springframework.expression

Examples of org.springframework.expression.ExpressionParser.parseExpression()


    double return_ddd = e.getValue(ctx,Double.TYPE);
    assertEquals(3.0d,return_ddd,0d);
    assertEquals(3.0d,helper.ddd,0d);

    // float
    e = parser.parseExpression("++fff");
    assertEquals(3.0f,helper.fff,0d);
    float return_fff = e.getValue(ctx,Float.TYPE);
    assertEquals(4.0f,return_fff,0d);
    assertEquals(4.0f,helper.fff,0d);
View Full Code Here


    float return_fff = e.getValue(ctx,Float.TYPE);
    assertEquals(4.0f,return_fff,0d);
    assertEquals(4.0f,helper.fff,0d);

    // long
    e = parser.parseExpression("++lll");
    assertEquals(66666L,helper.lll);
    long return_lll = e.getValue(ctx,Long.TYPE);
    assertEquals(66667L,return_lll);
    assertEquals(66667L,helper.lll);
View Full Code Here

    long return_lll = e.getValue(ctx,Long.TYPE);
    assertEquals(66667L,return_lll);
    assertEquals(66667L,helper.lll);

    // int
    e = parser.parseExpression("++iii");
    assertEquals(42,helper.iii);
    int return_iii = e.getValue(ctx,Integer.TYPE);
    assertEquals(43,return_iii);
    assertEquals(43,helper.iii);
    return_iii = e.getValue(ctx,Integer.TYPE);
View Full Code Here

    return_iii = e.getValue(ctx,Integer.TYPE);
    assertEquals(44,return_iii);
    assertEquals(44,helper.iii);

    // short
    e = parser.parseExpression("++sss");
    assertEquals(15,helper.sss);
    int return_sss = (Integer)e.getValue(ctx);
    assertEquals(16,return_sss);
    assertEquals(16,helper.sss);
  }
View Full Code Here

    Spr9751 helper = new Spr9751();
    StandardEvaluationContext ctx = new StandardEvaluationContext(helper);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Expression e = null;

    e = parser.parseExpression("m()++");
    try {
      e.getValue(ctx,Double.TYPE);
      fail();
    } catch (SpelEvaluationException see) {
      assertEquals(SpelMessage.OPERAND_NOT_INCREMENTABLE,see.getMessageCode());
View Full Code Here

      fail();
    } catch (SpelEvaluationException see) {
      assertEquals(SpelMessage.OPERAND_NOT_INCREMENTABLE,see.getMessageCode());
    }

    e = parser.parseExpression("++m()");
    try {
      e.getValue(ctx,Double.TYPE);
      fail();
    } catch (SpelEvaluationException see) {
      assertEquals(SpelMessage.OPERAND_NOT_INCREMENTABLE,see.getMessageCode());
View Full Code Here

  public void increment04() {
    Integer i = 42;
    StandardEvaluationContext ctx = new StandardEvaluationContext(i);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    try {
      Expression e =  parser.parseExpression("++1");
      e.getValue(ctx,Integer.class);
      fail();
    } catch (SpelEvaluationException see) {
      assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
    }
View Full Code Here

      fail();
    } catch (SpelEvaluationException see) {
      assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
    }
    try {
      Expression e =  parser.parseExpression("1++");
      e.getValue(ctx,Integer.class);
      fail();
    } catch (SpelEvaluationException see) {
      assertEquals(SpelMessage.NOT_ASSIGNABLE,see.getMessageCode());
    }
View Full Code Here

  @Test
  public void decrement01root() {
    Integer i = 42;
    StandardEvaluationContext ctx = new StandardEvaluationContext(i);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Expression e =  parser.parseExpression("#this--");
    assertEquals(42,i.intValue());
    try {
      e.getValue(ctx,Integer.class);
      fail();
    } catch (SpelEvaluationException see) {
View Full Code Here

    StandardEvaluationContext ctx = new StandardEvaluationContext(helper);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Expression e = null;

    // BigDecimal
    e = parser.parseExpression("bd--");
    assertTrue(new BigDecimal("2").equals(helper.bd));
    BigDecimal return_bd = e.getValue(ctx,BigDecimal.class);
    assertTrue(new BigDecimal("2").equals(return_bd));
    assertTrue(new BigDecimal("1").equals(helper.bd));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.