Examples of parseRaw()


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

    ex = "getReserver().DIV";
    exp = parser.parseRaw(ex);
    assertEquals(1, exp.getValue(ctx));

    ex = "getReserver().div";
    exp = parser.parseRaw(ex);
    assertEquals(3, exp.getValue(ctx));

    exp = parser.parseRaw("NE");
    assertEquals("abc", exp.getValue(ctx));
  }
View Full Code Here

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

    ex = "getReserver().div";
    exp = parser.parseRaw(ex);
    assertEquals(3, exp.getValue(ctx));

    exp = parser.parseRaw("NE");
    assertEquals("abc", exp.getValue(ctx));
  }

  @Test
  public void reservedWordProperties_9862() throws Exception {
View Full Code Here

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

  @Test
  public void reservedWordProperties_9862() throws Exception {
    StandardEvaluationContext ctx = new StandardEvaluationContext();
    SpelExpressionParser parser = new SpelExpressionParser();
    SpelExpression expression = parser.parseRaw("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST");
    Object value = expression.getValue(ctx);
    assertEquals(value, Reserver.CONST);
  }

  /**
 
View Full Code Here

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

  @Test
  public void testScenario01_Roles() throws Exception {
    try {
      SpelExpressionParser parser = new SpelExpressionParser();
      StandardEvaluationContext ctx = new StandardEvaluationContext();
      Expression expr = parser.parseRaw("hasAnyRole('MANAGER','TELLER')");

      ctx.setRootObject(new Person("Ben"));
      Boolean value = expr.getValue(ctx,Boolean.class);
      assertFalse(value);
View Full Code Here

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

    ctx.addPropertyAccessor(new SecurityPrincipalAccessor());

    // Multiple options for supporting this expression: "p.name == principal.name"
    // (1) If the right person is the root context object then "name==principal.name" is good enough
    Expression expr = parser.parseRaw("name == principal.name");

    ctx.setRootObject(new Person("Andy"));
    Boolean value = expr.getValue(ctx,Boolean.class);
    assertTrue(value);
View Full Code Here

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

    ctx.setRootObject(new Person("Christian"));
    value = expr.getValue(ctx,Boolean.class);
    assertFalse(value);

    // (2) Or register an accessor that can understand 'p' and return the right person
    expr = parser.parseRaw("p.name == principal.name");

    PersonAccessor pAccessor = new PersonAccessor();
    ctx.addPropertyAccessor(pAccessor);
    ctx.setRootObject(null);
View Full Code Here

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

    SpelExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext ctx = new StandardEvaluationContext();

    // Might be better with a as a variable although it would work as a property too...
    // Variable references using a '#'
    Expression expr = parser.parseRaw("(hasRole('SUPERVISOR') or (#a <  1.042)) and hasIpAddress('10.10.0.0/16')");

    Boolean value = null;

    ctx.setVariable("a",1.0d); // referenced as #a in the expression
    ctx.setRootObject(new Supervisor("Ben")); // so non-qualified references 'hasRole()' 'hasIpAddress()' are invoked against it
View Full Code Here

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

    ctx.addMethodResolver(new MyMethodResolver()); // NEEDS TO OVERRIDE THE REFLECTION ONE - SHOW REORDERING MECHANISM
    // Might be better with a as a variable although it would work as a property too...
    // Variable references using a '#'
//    SpelExpression expr = parser.parseExpression("(hasRole('SUPERVISOR') or (#a <  1.042)) and hasIpAddress('10.10.0.0/16')");
    Expression expr = parser.parseRaw("(hasRole(3) or (#a <  1.042)) and hasIpAddress('10.10.0.0/16')");

    Boolean value = null;

    ctx.setVariable("a",1.0d); // referenced as #a in the expression
    value = expr.getValue(ctx,Boolean.class);
View Full Code Here

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

    // Even though this property accessor is added after the reflection one, it specifically
    // names the String class as the type it is interested in so is chosen in preference to
    // any 'default' ones
    ctx.addPropertyAccessor(new StringyPropertyAccessor());
    Expression expr = parser.parseRaw("new String('hello').flibbles");
    Integer i = expr.getValue(ctx, Integer.class);
    assertEquals((int) i, 7);

    // The reflection one will be used for other properties...
    expr = parser.parseRaw("new String('hello').CASE_INSENSITIVE_ORDER");
View Full Code Here

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

    Expression expr = parser.parseRaw("new String('hello').flibbles");
    Integer i = expr.getValue(ctx, Integer.class);
    assertEquals((int) i, 7);

    // The reflection one will be used for other properties...
    expr = parser.parseRaw("new String('hello').CASE_INSENSITIVE_ORDER");
    Object o = expr.getValue(ctx);
    assertNotNull(o);

    expr = parser.parseRaw("new String('hello').flibbles");
    expr.setValue(ctx, 99);
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.