ExpressionBuilder (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.el.lang, class: ExpressionBuilder

# 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 Summary

  Constructors
  Constructor
  Description
  `ExpressionBuilder(String expression, ELContext ctx)`
  Creates a new ExpressionBuilder for the given expression and context.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MethodExpression`
  `createMethodExpression(Class<?> expectedReturnType, Class<?>[] expectedParamTypes)`
  Creates a MethodExpression from the parsed expression.
  `static org.apache.el.parser.Node`
  `createNode(String expr)`
  Creates a parsed AST node for the given expression string.
  `ValueExpression`
  `createValueExpression(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 Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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