Package com.sun.el.parser

Examples of com.sun.el.parser.Node


     * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext)
     */
    public MethodInfo getMethodInfo(ELContext context)
            throws PropertyNotFoundException, MethodNotFoundException,
            ELException {
        Node n = this.getNode();
        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                this.varMapper);
        return n.getMethodInfo(ctx, this.paramTypes);
    }
View Full Code Here


            this.varMapper = new VariableMapperFactory(ctxVar);
        }
    }

    public final static Node createNode(String expr) throws ELException {
        Node n = createNodeInternal(expr);
        return n;
    }
View Full Code Here

            throws ELException {
        if (expr == null) {
            throw new ELException(MessageFactory.get("error.null"));
        }

        Node n = (Node) cache.get(expr);
        if (n == null) {
            try {
                n = (new ELParser(new StringReader(expr)))
                        .CompositeExpression();

                // validate composite expression
                if (n instanceof AstCompositeExpression) {
                    int numChildren = n.jjtGetNumChildren();
                    if (numChildren == 1) {
                        n = n.jjtGetChild(0);
                    } else {
                        Class type = null;
                        Node child = null;
                        for (int i = 0; i < numChildren; i++) {
                            child = n.jjtGetChild(i);
                            if (child instanceof AstLiteralExpression)
                                continue;
                            if (type == null)
                                type = child.getClass();
                            else {
                                if (!type.equals(child.getClass())) {
                                    throw new ELException(MessageFactory.get(
                                            "error.mixed", expr));
                                }
                            }
                        }
View Full Code Here

            this.varMapper = ((VariableMapperFactory) this.varMapper).create();
        }
    }

    private Node build() throws ELException {
        Node n = createNodeInternal(this.expression);
        this.prepare(n);
        if (n instanceof AstDeferredExpression
                || n instanceof AstDynamicExpression) {
            n = n.jjtGetChild(0);
        }
        return n;
    }
View Full Code Here

        }
    }

    public ValueExpression createValueExpression(Class expectedType)
            throws ELException {
        Node n = this.build();
        return new ValueExpressionImpl(this.expression, n, this.fnMapper,
                this.varMapper, expectedType);
    }
View Full Code Here

                this.varMapper, expectedType);
    }

    public MethodExpression createMethodExpression(Class expectedReturnType,
            Class[] expectedParamTypes) throws ELException {
        Node n = this.build();
        if (n instanceof AstValue || n instanceof AstIdentifier) {
            return new MethodExpressionImpl(expression, n,
                    this.fnMapper, this.varMapper, expectedReturnType,
                    expectedParamTypes);
        } else if (n instanceof AstLiteralExpression) {
View Full Code Here

    this.functionsMap.put("a4jSkin:getParameter",
        "org.ajax4jsf.framework.skin.getParameter");
  }

  public String compileEL(String expression, CompilationContext componentBean) {
    Node node = ELParser.parse(expression);
    StringBuffer sbMain = new StringBuffer();
    processNode(node, sbMain, componentBean);
    return sbMain.toString();
  }
View Full Code Here

      CompilationContext componentBean) {
    int numChildren = node.jjtGetNumChildren();

    boolean bNeedConversion = false;
    for (int i = 0; i < numChildren; i++) {
      Node childNode = node.jjtGetChild(i);
      if (childNode instanceof AstLiteralExpression) {
        bNeedConversion = true;
        break;
      }
    }

    for (int i = 0; i < numChildren; i++) {
      Node childNode = node.jjtGetChild(i);

      if (childNode instanceof AstLiteralExpression) {
        if (childNode.getImage() != null) {
          if (i > 0) {
            sbMain.append(" + ");
          }
          sbMain.append("\"");
          sbMain.append(StringUtils.getEscapedString(childNode
              .getImage()));
          sbMain.append("\"");

          if (i < (numChildren - 1)) {
            sbMain.append(" + ");
View Full Code Here

  private boolean processingEmpty(AstEmpty node, StringBuffer sbMain,
      CompilationContext componentBean) {
    boolean returnValue = false;
    StringBuffer sb1 = new StringBuffer();
   
    Node node1 = node.jjtGetChild(0);

    if (null != node1) {
      if (!(returnValue = processingNode(node1, sb1,
          componentBean))) {
        log.error("Error processing node1: "
            + node1.getImage());
      }
    }
   
    if (returnValue) {
      sbMain.append(" getUtils().isEmpty( ");
View Full Code Here

   
    StringBuffer sb1 = new StringBuffer();
    StringBuffer sb2 = new StringBuffer();
    StringBuffer sb3 = new StringBuffer();
   
    Node node1 = node.jjtGetChild(0);

    if (node1 != null) {
      if (!(returnValue &= processingNode(node1, sb1,
          componentBean))) {
        log.error("Error processing node1: "
            + node1.getImage());
      }
    }
   
    Node node2 = node.jjtGetChild(1);

    if (null != node2) {
      if (!(returnValue &= processingNode(node2, sb2,
          componentBean))) {
        log.error("Error processing node2: "
            + node2.getImage());
      }
    }
   
    Node node3 = node.jjtGetChild(2);

    if (null != node3) {
      if (!(returnValue &= processingNode(node3, sb3,
          componentBean))) {
        log.error("Error processing node3: "
            + node3.getImage());
      }
    }
   
    if (returnValue) {
      sbMain.append(" ( ");
View Full Code Here

TOP

Related Classes of com.sun.el.parser.Node

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.