MethodExpression (EL 6.0 API Documentation - Apache Tomcat 11.0.25)
Description: declaration: package: jakarta.el, class: MethodExpression

# Class MethodExpression

java.lang.Object
jakarta.el.Expression
jakarta.el.MethodExpression

All Implemented Interfaces:
  `Serializable`

public abstract class MethodExpression extends Expression
Represents a compiled EL method expression. A MethodExpression is the result of compiling an EL expression that resolves to a method, and can be invoked at a later time with a given set of parameters.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MethodExpression()`
  Constructs a MethodExpression.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract MethodInfo`
  `getMethodInfo(ELContext context)`
  Returns information about the method that this expression resolves to.
  `MethodReference`
  `getMethodReference(ELContext context)`
  Obtain the `MethodReference` for the method to which this method expression resolves.
  `abstract Object`
  `invoke(ELContext context, Object[] params)`
  Invokes the method that this expression resolves to with the given parameters.
  `boolean`
  `isParametersProvided()`
  Returns whether the parameters for the method invocation are provided by the expression or by the container.

  ### Methods inherited from class Expression

  `equals, getExpressionString, hashCode, isLiteralText`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### MethodExpression

    public MethodExpression()
    Constructs a MethodExpression.

- ## Method Details

  - ### getMethodInfo

    public abstract MethodInfo getMethodInfo(ELContext context)
    Returns information about the method that this expression resolves to.
    Parameters:
      `context` - The EL context for this evaluation
    Returns:
      Information about the method that this expression resolves to
    Throws:
      `NullPointerException` - If the supplied context is `null`
      `PropertyNotFoundException` - If a property/variable resolution failed because no match was found or a match was found but was not readable
      `MethodNotFoundException` - If no matching method can be found
      `ELException` - Wraps any exception throw whilst resolving the property

  - ### invoke

    public abstract Object invoke(ELContext context, Object[] params)
    Invokes the method that this expression resolves to with the given parameters.
    Parameters:
      `context` - The EL context for this evaluation
      `params` - The parameters with which to invoke this method expression
    Returns:
      The result of invoking this method expression
    Throws:
      `NullPointerException` - If the supplied context is `null`
      `PropertyNotFoundException` - If a property/variable resolution failed because no match was found or a match was found but was not readable
      `MethodNotFoundException` - If no matching method can be found
      `ELException` - Wraps any exception throw whilst resolving the property or coercion of the result to the expected return type fails

  - ### isParametersProvided

    public boolean isParametersProvided()
    Returns whether the parameters for the method invocation are provided by the expression or by the container.
    Returns:
      This default implementation always returns `false`
    Since:
      EL 3.0

  - ### getMethodReference

    public MethodReference getMethodReference(ELContext context)
    Obtain the `MethodReference` for the method to which this method expression resolves.
    Parameters:
      `context` - The EL context for this evaluation
    Returns:
      This default implementation always returns `null`
    Throws:
      `NullPointerException` - If the supplied context is `null`
      `PropertyNotFoundException` - If a property/variable resolution failed because no match was found or a match was found but was not readable
      `MethodNotFoundException` - If no matching method can be found
      `ELException` - Wraps any exception throw whilst resolving the property
    Since:
      EL 5.0