Package org.springframework.expression.spel.ast

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


    return expr;
  }
 
  //sumExpression: productExpression ( (PLUS^ | MINUS^) productExpression)*;
  private SpelNodeImpl eatSumExpression() {
    SpelNodeImpl expr = eatProductExpression();   
    while (peekToken(TokenKind.PLUS,TokenKind.MINUS)) {
      Token t = nextToken();//consume PLUS or MINUS
      SpelNodeImpl rhExpr = eatProductExpression();
      checkRightOperand(t,rhExpr);
      if (t.kind==TokenKind.PLUS) {
        expr = new OpPlus(toPos(t),expr,rhExpr);
      } else {
        Assert.isTrue(t.kind==TokenKind.MINUS);
View Full Code Here


    return expr;
  }
 
  // productExpression: powerExpr ((STAR^ | DIV^| MOD^) powerExpr)* ;
  private SpelNodeImpl eatProductExpression() {
    SpelNodeImpl expr = eatPowerExpression();
    while (peekToken(TokenKind.STAR,TokenKind.DIV,TokenKind.MOD)) {
      Token t = nextToken(); // consume STAR/DIV/MOD
      SpelNodeImpl rhExpr = eatPowerExpression();
      checkRightOperand(t,rhExpr);
      if (t.kind==TokenKind.STAR) {
        expr = new OpMultiply(toPos(t),expr,rhExpr);
      } else if (t.kind==TokenKind.DIV) {
        expr = new OpDivide(toPos(t),expr,rhExpr);
View Full Code Here

    return expr;
  }
 
  // powerExpr  : unaryExpression (POWER^ unaryExpression)? ;
  private SpelNodeImpl eatPowerExpression() {
    SpelNodeImpl expr = eatUnaryExpression();
    if (peekToken(TokenKind.POWER)) {
      Token t = nextToken();//consume POWER
      SpelNodeImpl rhExpr = eatUnaryExpression();
      checkRightOperand(t,rhExpr);
      return new OperatorPower(toPos(t),expr, rhExpr);
    }
    return expr;
  }
View Full Code Here

  // unaryExpression: (PLUS^ | MINUS^ | BANG^) unaryExpression | primaryExpression ;
  private SpelNodeImpl eatUnaryExpression() {
    if (peekToken(TokenKind.PLUS,TokenKind.MINUS,TokenKind.NOT)) {
      Token t = nextToken();
      SpelNodeImpl expr = eatUnaryExpression();
      if (t.kind==TokenKind.NOT) {
        return new OperatorNot(toPos(t),expr);
      } else if (t.kind==TokenKind.PLUS) {
        return new OpPlus(toPos(t),expr);
      } else {
View Full Code Here

  }
 
  // primaryExpression : startNode (node)? -> ^(EXPRESSION startNode (node)?);
  private SpelNodeImpl eatPrimaryExpression() {
    List<SpelNodeImpl> nodes = new ArrayList<SpelNodeImpl>();
    SpelNodeImpl start = eatStartNode(); // always a start node
    nodes.add(start);
    while (maybeEatNode()) {
      nodes.add(pop());
    }
    if (nodes.size()==1) {
      return nodes.get(0);
    } else {
      return new CompoundExpression(toPos(start.getStartPosition(),nodes.get(nodes.size()-1).getEndPosition()),nodes.toArray(new SpelNodeImpl[nodes.size()]));
    }
  }
View Full Code Here

    }
  }
 
  // node : ((DOT dottedNode) | (SAFE_NAVI dottedNode) | nonDottedNode)+;
  private boolean maybeEatNode() {
    SpelNodeImpl expr = null;
    if (peekToken(TokenKind.DOT,TokenKind.SAFE_NAVI)) {
      expr = eatDottedNode();
    } else {
      expr = maybeEatNonDottedNode();
    }
View Full Code Here

      if (!typeName.stringValue().equals("T")) {
        return false;
      }
      nextToken();
      eatToken(TokenKind.LPAREN);
      SpelNodeImpl node = eatPossiblyQualifiedId(true);
      // dotted qualified id
      eatToken(TokenKind.RPAREN);
      constructedNodes.push(new TypeReference(toPos(typeName),node));
      return true;
    }
View Full Code Here

  private boolean maybeEatProjection(boolean nullSafeNavigation) {
    Token t = peekToken();
    if (!peekToken(TokenKind.PROJECT,true)) {
      return false;
    }
    SpelNodeImpl expr = eatExpression();
    eatToken(TokenKind.RSQUARE);
    constructedNodes.push(new Projection(nullSafeNavigation, toPos(t), expr));
    return true;
  }
View Full Code Here

  private boolean maybeEatIndexer() {
    Token t = peekToken();
    if (!peekToken(TokenKind.LSQUARE,true)) {
      return false;
    }
    SpelNodeImpl expr = eatExpression();
    eatToken(TokenKind.RSQUARE);
    constructedNodes.push(new Indexer(toPos(t),expr));
    return true;
  }
View Full Code Here

    Token t = peekToken();
    if (!peekSelectToken()) {
      return false;
    }
    nextToken();
    SpelNodeImpl expr = eatExpression();
    eatToken(TokenKind.RSQUARE);
    if (t.kind==TokenKind.SELECT_FIRST) {     
      constructedNodes.push(new Selection(nullSafeNavigation,Selection.FIRST,toPos(t),expr));
    } else if (t.kind==TokenKind.SELECT_LAST) {
      constructedNodes.push(new Selection(nullSafeNavigation,Selection.LAST,toPos(t),expr));
View Full Code Here

TOP

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

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.