Search in sources :

Example 1 with MethodReference

use of jakarta.el.MethodReference in project tomcat by apache.

the class MethodExpressionImpl method getMethodReference.

@Override
public MethodReference getMethodReference(ELContext context) {
    EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper);
    ctx.notifyBeforeEvaluation(getExpressionString());
    MethodReference methodReference = this.getNode().getMethodReference(ctx);
    ctx.notifyAfterEvaluation(getExpressionString());
    return methodReference;
}
Also used : MethodReference(jakarta.el.MethodReference) EvaluationContext(org.apache.el.lang.EvaluationContext)

Example 2 with MethodReference

use of jakarta.el.MethodReference in project tomcat by apache.

the class MethodExpressionLiteral method getMethodReference.

@Override
public MethodReference getMethodReference(ELContext context) {
    if (context == null) {
        throw new NullPointerException(MessageFactory.get("error.context.null"));
    }
    context.notifyBeforeEvaluation(getExpressionString());
    MethodReference result = new MethodReference(null, getMethodInfoInternal(), EMPTY_ANNOTATION_ARRAY, EMPTY_OBJECT_ARRAY);
    context.notifyAfterEvaluation(getExpressionString());
    return result;
}
Also used : MethodReference(jakarta.el.MethodReference)

Example 3 with MethodReference

use of jakarta.el.MethodReference in project tomcat by apache.

the class AstValue method getMethodReference.

@Override
public MethodReference getMethodReference(EvaluationContext ctx) {
    Target t = getTarget(ctx);
    Method m = null;
    Object[] values = null;
    Class<?>[] types = null;
    if (isParametersProvided()) {
        values = ((AstMethodParameters) this.jjtGetChild(this.jjtGetNumChildren() - 1)).getParameters(ctx);
        types = getTypesFromValues(values);
    }
    m = ReflectionUtil.getMethod(ctx, t.base, t.property, types, values);
    // Handle varArgs and any coercion required
    values = convertArgs(ctx, values, m);
    return new MethodReference(t.base, getMethodInfo(ctx, types), m.getAnnotations(), values);
}
Also used : MethodReference(jakarta.el.MethodReference) Method(java.lang.reflect.Method)

Example 4 with MethodReference

use of jakarta.el.MethodReference in project tomcat by apache.

the class JspMethodExpression method getMethodReference.

@Override
public MethodReference getMethodReference(ELContext context) {
    context.notifyBeforeEvaluation(getExpressionString());
    try {
        MethodReference result = this.target.getMethodReference(context);
        context.notifyAfterEvaluation(getExpressionString());
        return result;
    } catch (MethodNotFoundException e) {
        if (e instanceof JspMethodNotFoundException) {
            throw e;
        }
        throw new JspMethodNotFoundException(this.mark, e);
    } catch (PropertyNotFoundException e) {
        if (e instanceof JspPropertyNotFoundException) {
            throw e;
        }
        throw new JspPropertyNotFoundException(this.mark, e);
    } catch (ELException e) {
        if (e instanceof JspELException) {
            throw e;
        }
        throw new JspELException(this.mark, e);
    }
}
Also used : PropertyNotFoundException(jakarta.el.PropertyNotFoundException) MethodReference(jakarta.el.MethodReference) ELException(jakarta.el.ELException) MethodNotFoundException(jakarta.el.MethodNotFoundException)

Aggregations

MethodReference (jakarta.el.MethodReference)4 ELException (jakarta.el.ELException)1 MethodNotFoundException (jakarta.el.MethodNotFoundException)1 PropertyNotFoundException (jakarta.el.PropertyNotFoundException)1 Method (java.lang.reflect.Method)1 EvaluationContext (org.apache.el.lang.EvaluationContext)1