Class ExpressionBuilder

  • All Implemented Interfaces:
    org.apache.el.parser.NodeVisitor

    public final class ExpressionBuilder
    extends java.lang.Object
    implements org.apache.el.parser.NodeVisitor
    Builds compiled EL expressions from parsed AST nodes.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExpressionBuilder​(java.lang.String expression, ELContext ctx)
      Creates a new ExpressionBuilder for the given expression and context.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MethodExpression createMethodExpression​(java.lang.Class<?> expectedReturnType, java.lang.Class<?>[] expectedParamTypes)
      Creates a MethodExpression from the parsed expression.
      static org.apache.el.parser.Node createNode​(java.lang.String expr)
      Creates a parsed AST node for the given expression string.
      ValueExpression createValueExpression​(java.lang.Class<?> expectedType)
      Creates a ValueExpression from the parsed expression.
      void visit​(org.apache.el.parser.Node node)
      Visits the given node.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExpressionBuilder

        public ExpressionBuilder​(java.lang.String expression,
                                 ELContext ctx)
                          throws ELException
        Creates a new ExpressionBuilder for the given expression and context.
        Parameters:
        expression - the EL expression string
        ctx - the EL context
        Throws:
        ELException - if the expression is invalid
    • Method Detail

      • createNode

        public static org.apache.el.parser.Node createNode​(java.lang.String expr)
                                                    throws ELException
        Creates a parsed AST node for the given expression string.
        Parameters:
        expr - the expression string to parse
        Returns:
        the parsed AST node
        Throws:
        ELException - if parsing fails
      • visit

        public void visit​(org.apache.el.parser.Node node)
                   throws ELException
        Description copied from interface: org.apache.el.parser.NodeVisitor
        Visits the given node.
        Specified by:
        visit in interface org.apache.el.parser.NodeVisitor
        Parameters:
        node - the node to visit
        Throws:
        ELException
      • createValueExpression

        public ValueExpression createValueExpression​(java.lang.Class<?> expectedType)
                                              throws ELException
        Creates a ValueExpression from the parsed expression.
        Parameters:
        expectedType - the expected type of the expression result
        Returns:
        the value expression
        Throws:
        ELException - if expression building fails
      • createMethodExpression

        public MethodExpression createMethodExpression​(java.lang.Class<?> expectedReturnType,
                                                       java.lang.Class<?>[] expectedParamTypes)
                                                throws ELException
        Creates a MethodExpression from the parsed expression.
        Parameters:
        expectedReturnType - the expected return type
        expectedParamTypes - the expected parameter types
        Returns:
        the method expression
        Throws:
        ELException - if expression building fails