Package org.springframework.expression.spel.ast

Examples of org.springframework.expression.spel.ast.Operator


    evaluate("new java.math.BigDecimal('5') ^ 3", new BigDecimal("125"), BigDecimal.class);
  }

  @Test
  public void testOperatorNames() throws Exception {
    Operator node = getOperatorNode((SpelExpression)parser.parseExpression("1==3"));
    assertEquals("==",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("1!=3"));
    assertEquals("!=",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3/3"));
    assertEquals("/",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3+3"));
    assertEquals("+",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3-3"));
    assertEquals("-",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3<4"));
    assertEquals("<",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3<=4"));
    assertEquals("<=",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3*4"));
    assertEquals("*",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3%4"));
    assertEquals("%",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3>=4"));
    assertEquals(">=",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3 between 4"));
    assertEquals("between",node.getOperatorName());

    node = getOperatorNode((SpelExpression)parser.parseExpression("3 ^ 4"));
    assertEquals("^",node.getOperatorName());
  }
View Full Code Here


    if (node instanceof Operator) {
      return (Operator) node;
    }
    int childCount = node.getChildCount();
    for (int i = 0; i < childCount; i++) {
      Operator possible = findOperator(node.getChild(i));
      if (possible != null) {
        return possible;
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of org.springframework.expression.spel.ast.Operator

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.