Class ExpressionBuilder

java.lang.Object
org.apache.el.lang.ExpressionBuilder
All Implemented Interfaces:
org.apache.el.parser.NodeVisitor

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

    • ExpressionBuilder

      public ExpressionBuilder(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 Details

    • createNode

      public static org.apache.el.parser.Node createNode(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(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(Class<?> expectedReturnType, 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