Search in sources :

Example 6 with Node

use of org.apache.el.parser.Node in project tomcat by apache.

the class MethodExpressionImpl method getMethodInfo.

/**
 * Evaluates the expression relative to the provided context, and returns
 * information about the actual referenced method.
 *
 * @param context
 *            The context of this evaluation
 * @return an instance of <code>MethodInfo</code> containing information
 *         about the method the expression evaluated to.
 * @throws NullPointerException
 *             if context is <code>null</code> or the base object is
 *             <code>null</code> on the last resolution.
 * @throws PropertyNotFoundException
 *             if one of the property resolutions failed because a specified
 *             variable or property does not exist or is not readable.
 * @throws MethodNotFoundException
 *             if no suitable method can be found.
 * @throws ELException
 *             if an exception was thrown while performing property or
 *             variable resolution. The thrown exception must be included as
 *             the cause property of this exception, if available.
 * @see jakarta.el.MethodExpression#getMethodInfo(jakarta.el.ELContext)
 */
@Override
public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException {
    Node n = this.getNode();
    EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
    ctx.notifyBeforeEvaluation(getExpressionString());
    MethodInfo result = n.getMethodInfo(ctx, this.paramTypes);
    ctx.notifyAfterEvaluation(getExpressionString());
    return result;
}
Also used : Node(org.apache.el.parser.Node) MethodInfo(jakarta.el.MethodInfo) EvaluationContext(org.apache.el.lang.EvaluationContext)

Aggregations

Node (org.apache.el.parser.Node)6 AstDeferredExpression (org.apache.el.parser.AstDeferredExpression)4 AstDynamicExpression (org.apache.el.parser.AstDynamicExpression)4 StringReader (java.io.StringReader)2 EvaluationContext (org.apache.el.lang.EvaluationContext)2 AstLiteralExpression (org.apache.el.parser.AstLiteralExpression)2 ELParser (org.apache.el.parser.ELParser)2 ELException (jakarta.el.ELException)1 MethodInfo (jakarta.el.MethodInfo)1 ELException (javax.el.ELException)1