# Class MethodExpressionLiteral

java.lang.Object
jakarta.el.Expression
jakarta.el.MethodExpression
org.apache.el.MethodExpressionLiteral

All Implemented Interfaces:
  `Externalizable, Serializable`

public class MethodExpressionLiteral extends MethodExpression implements Externalizable
Literal method expression.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`MethodExpressionLiteral()`
Default constructor.
`MethodExpressionLiteral(String expr, Class<?> expectedType, Class<?>[] paramTypes)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`String`
`getExpressionString()`
Returns the original string representation of this EL expression as it was parsed.
`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.
`int`
`hashCode()`
`Object`
`invoke(ELContext context, Object[] params)`
Invokes the method that this expression resolves to with the given parameters.
`boolean`
`isLiteralText()`
Returns whether this expression is a literal text expression, meaning it does not contain any variables, functions, or operators and evaluates to a constant value.
`void`
`readExternal(ObjectInput in)`
`void`
`writeExternal(ObjectOutput out)`

### Methods inherited from class MethodExpression

`isParametersProvided`

### Methods inherited from class Object

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

## Constructor Details

### MethodExpressionLiteral

public MethodExpressionLiteral()
Default constructor.

### MethodExpressionLiteral

public MethodExpressionLiteral(String expr, Class<?> expectedType, Class<?>[] paramTypes)
Constructor.

Parameters:
  `expr` - the expression
  `expectedType` - the expected type
  `paramTypes` - the parameter types

## Method Details

### getMethodInfo

public MethodInfo getMethodInfo(ELContext context) throws ELException
Description copied from class: `jakarta.el.MethodExpression`
Returns information about the method that this expression resolves to.

Specified by:
  `getMethodInfo` in class `MethodExpression`
Parameters:
  `context` - The EL context for this evaluation
Returns:
  Information about the method that this expression resolves to
Throws:
  `ELException` - Wraps any exception throw whilst resolving the property

### invoke

public Object invoke(ELContext context, Object[] params) throws ELException
Description copied from class: `jakarta.el.MethodExpression`
Invokes the method that this expression resolves to with the given parameters.

Specified by:
  `invoke` in class `MethodExpression`
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:
  `ELException` - Wraps any exception throw whilst resolving the property or coercion of the result to the expected return type fails

### getMethodReference

public MethodReference getMethodReference(ELContext context)
Description copied from class: `jakarta.el.MethodExpression`
Obtain the `MethodReference` for the method to which this method expression resolves.

Overrides:
  `getMethodReference` in class `MethodExpression`
Parameters:
  `context` - The EL context for this evaluation
Returns:
  This default implementation always returns `null`

### getExpressionString

public String getExpressionString()
Description copied from class: `jakarta.el.Expression`
Returns the original string representation of this EL expression as it was parsed.

Specified by:
  `getExpressionString` in class `Expression`
Returns:
  the string representation of this expression

### equals

public boolean equals(Object obj)

Specified by:
  `equals` in class `Expression`

### hashCode

public int hashCode()

Specified by:
  `hashCode` in class `Expression`

### isLiteralText

public boolean isLiteralText()
Description copied from class: `jakarta.el.Expression`
Returns whether this expression is a literal text expression, meaning it does not contain any variables, functions, or operators and evaluates to a constant value.

Specified by:
  `isLiteralText` in class `Expression`
Returns:
  `true` if this expression is a literal text, `false` otherwise

### readExternal

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

### writeExternal

public void writeExternal(ObjectOutput out) throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`