Package org.springframework.expression.spel.standard

Examples of org.springframework.expression.spel.standard.SpelExpressionParser.parseExpression()


  public void testCreateObjectsOnAttemptToReferenceNull() throws Exception {
    TestClass testClass = new TestClass();
    StandardEvaluationContext ctx = new StandardEvaluationContext(testClass);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Object o = null;
    o = parser.parseExpression("wibble.bar").getValue(ctx);
    assertEquals("hello", o);
    o = parser.parseExpression("wibble").getValue(ctx);
    assertNotNull(o);

    o = parser.parseExpression("wibble2.bar").getValue(ctx);
View Full Code Here


    StandardEvaluationContext ctx = new StandardEvaluationContext(testClass);
    ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Object o = null;
    o = parser.parseExpression("wibble.bar").getValue(ctx);
    assertEquals("hello", o);
    o = parser.parseExpression("wibble").getValue(ctx);
    assertNotNull(o);

    o = parser.parseExpression("wibble2.bar").getValue(ctx);
  }
View Full Code Here

    o = parser.parseExpression("wibble.bar").getValue(ctx);
    assertEquals("hello", o);
    o = parser.parseExpression("wibble").getValue(ctx);
    assertNotNull(o);

    o = parser.parseExpression("wibble2.bar").getValue(ctx);
  }


  @SuppressWarnings("rawtypes")
  static class TestClass {
View Full Code Here

  public void initializingCollectionElementsOnWrite() throws Exception {
    TestPerson person = new TestPerson();
    EvaluationContext context = new StandardEvaluationContext(person);
    SpelParserConfiguration config = new SpelParserConfiguration(true, true);
    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");
View Full Code Here

    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

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.