Package org.springframework.expression

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


    ExpressionParser parser = new SpelExpressionParser(config);
    Expression expression = parser.parseExpression("name");
    expression.setValue(context, "Oleg");
    assertEquals("Oleg", person.getName());

    expression = parser.parseExpression("address.street");
    expression.setValue(context, "123 High St");
    assertEquals("123 High St", person.getAddress().getStreet());

    expression = parser.parseExpression("address.crossStreets[0]");
    expression.setValue(context, "Blah");
View Full Code Here


    expression = parser.parseExpression("address.street");
    expression.setValue(context, "123 High St");
    assertEquals("123 High St", person.getAddress().getStreet());

    expression = parser.parseExpression("address.crossStreets[0]");
    expression.setValue(context, "Blah");
    assertEquals("Blah", person.getAddress().getCrossStreets().get(0));

    expression = parser.parseExpression("address.crossStreets[3]");
    expression.setValue(context, "Wibble");
View Full Code Here

    expression = parser.parseExpression("address.crossStreets[0]");
    expression.setValue(context, "Blah");
    assertEquals("Blah", person.getAddress().getCrossStreets().get(0));

    expression = parser.parseExpression("address.crossStreets[3]");
    expression.setValue(context, "Wibble");
    assertEquals("Blah", person.getAddress().getCrossStreets().get(0));
    assertEquals("Wibble", person.getAddress().getCrossStreets().get(3));
  }
View Full Code Here

  @Test
  public void caseInsensitiveNullLiterals() {
    ExpressionParser parser = new SpelExpressionParser();
    Expression exp;

    exp = parser.parseExpression("null");
    assertNull(exp.getValue());

    exp = parser.parseExpression("NULL");
    assertNull(exp.getValue());
View Full Code Here

    Expression exp;

    exp = parser.parseExpression("null");
    assertNull(exp.getValue());

    exp = parser.parseExpression("NULL");
    assertNull(exp.getValue());

    exp = parser.parseExpression("NuLl");
    assertNull(exp.getValue());
  }
View Full Code Here

    assertNull(exp.getValue());

    exp = parser.parseExpression("NULL");
    assertNull(exp.getValue());

    exp = parser.parseExpression("NuLl");
    assertNull(exp.getValue());
  }

  /**
   * Verifies behavior requested in SPR-9621.
View Full Code Here

    Spr9751 instance = new Spr9751();

    // Add a new element to the list
    StandardEvaluationContext ctx = new StandardEvaluationContext(instance);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Expression e =  parser.parseExpression("listOfStrings[++index3]='def'");
    e.getValue(ctx);
    assertEquals(2,instance.listOfStrings.size());
    assertEquals("def",instance.listOfStrings.get(1));

    // Check reference beyond end of collection
View Full Code Here

    assertEquals("def",instance.listOfStrings.get(1));

    // Check reference beyond end of collection
    ctx = new StandardEvaluationContext(instance);
    parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    e =  parser.parseExpression("listOfStrings[0]");
    String value = e.getValue(ctx,String.class);
    assertEquals("abc",value);
    e =  parser.parseExpression("listOfStrings[1]");
    value = e.getValue(ctx,String.class);
    assertEquals("def",value);
View Full Code Here

    ctx = new StandardEvaluationContext(instance);
    parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    e =  parser.parseExpression("listOfStrings[0]");
    String value = e.getValue(ctx,String.class);
    assertEquals("abc",value);
    e =  parser.parseExpression("listOfStrings[1]");
    value = e.getValue(ctx,String.class);
    assertEquals("def",value);
    e =  parser.parseExpression("listOfStrings[2]");
    value = e.getValue(ctx,String.class);
    assertEquals("",value);
View Full Code Here

    String value = e.getValue(ctx,String.class);
    assertEquals("abc",value);
    e =  parser.parseExpression("listOfStrings[1]");
    value = e.getValue(ctx,String.class);
    assertEquals("def",value);
    e =  parser.parseExpression("listOfStrings[2]");
    value = e.getValue(ctx,String.class);
    assertEquals("",value);

    // Now turn off growing and reference off the end
    ctx = new StandardEvaluationContext(instance);
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.