Class CompiledMethodExpression
java.lang.Object
jakarta.el.Expression
jakarta.el.MethodExpression
io.micronaut.el.runtime.CompiledMethodExpression
- All Implemented Interfaces:
CompiledExpression, ELExpressionIdentity, Serializable
- Direct Known Subclasses:
LiteralMethodExpression
public abstract class CompiledMethodExpression
extends jakarta.el.MethodExpression
implements CompiledExpression, ELExpressionIdentity
The base class of the
MethodExpression implementations generated at compilation time.- Since:
- 1.0
- Author:
- Denis Stepanov
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCompiledMethodExpression(String expressionString, @Nullable Class<?> expectedReturnType, Class<?> @Nullable [] expectedParamTypes, boolean parametersProvided) protectedCompiledMethodExpression(String expressionString, String canonicalForm, @Nullable Class<?> expectedReturnType, Class<?> @Nullable [] expectedParamTypes, boolean parametersProvided) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract @Nullable ObjectPerforms the compiled invocation.final Stringbooleanprotected Object @Nullable []evaluateArguments(jakarta.el.ELContext context) Evaluates the parameters an expression such as${bean.method(a, b)}provides itself.protected abstract @Nullable ObjectevaluateBase(jakarta.el.ELContext context) Evaluates the base object the method is invoked on, or the resolved method expression for an expression consisting of a single identifier.protected abstract @Nullable ObjectevaluateProperty(jakarta.el.ELContext context) protected Class<?>[]protected Class<?> final Stringjakarta.el.MethodInfogetMethodInfo(jakarta.el.ELContext context) jakarta.el.MethodReferencegetMethodReference(jakarta.el.ELContext context) inthashCode()@Nullable ObjectbooleanbooleantoString()final jakarta.el.MethodExpressionReturns an equivalent expression that does not coerce its invocation result.
-
Constructor Details
-
CompiledMethodExpression
protected CompiledMethodExpression(String expressionString, @Nullable Class<?> expectedReturnType, Class<?> @Nullable [] expectedParamTypes, boolean parametersProvided) - Parameters:
expressionString- The original expressionexpectedReturnType- The expected return type, ornullto return the result without coercionexpectedParamTypes- The expected parameter typesparametersProvided- Whether the parameters are provided by the expression itself
-
CompiledMethodExpression
protected CompiledMethodExpression(String expressionString, String canonicalForm, @Nullable Class<?> expectedReturnType, Class<?> @Nullable [] expectedParamTypes, boolean parametersProvided) - Parameters:
expressionString- The original expressioncanonicalForm- The canonical form of the expression, which is what equality comparesexpectedReturnType- The expected return type, ornullto return the result without coercionexpectedParamTypes- The expected parameter typesparametersProvided- Whether the parameters are provided by the expression itself
-
-
Method Details
-
evaluateBase
Evaluates the base object the method is invoked on, or the resolved method expression for an expression consisting of a single identifier.- Parameters:
context- The context- Returns:
- The base object
-
evaluateProperty
- Parameters:
context- The context- Returns:
- The name of the invoked method
-
doInvoke
protected abstract @Nullable Object doInvoke(jakarta.el.ELContext context, Object @Nullable [] arguments) Performs the compiled invocation.- Parameters:
context- The contextarguments- The arguments passed toinvoke(ELContext, Object[])- Returns:
- The result of the invocation, before the coercion to the expected return type
-
evaluateArguments
Evaluates the parameters an expression such as${bean.method(a, b)}provides itself.- Parameters:
context- The context- Returns:
- The evaluated parameters,
nullfor an expression that does not provide them
-
invoke
-
getMethodInfo
public jakarta.el.MethodInfo getMethodInfo(jakarta.el.ELContext context) - Specified by:
getMethodInfoin classjakarta.el.MethodExpression
-
getMethodReference
public jakarta.el.MethodReference getMethodReference(jakarta.el.ELContext context) - Overrides:
getMethodReferencein classjakarta.el.MethodExpression
-
isParametersProvided
public boolean isParametersProvided()- Overrides:
isParametersProvidedin classjakarta.el.MethodExpression
-
withoutExpectedReturnType
public final jakarta.el.MethodExpression withoutExpectedReturnType()Returns an equivalent expression that does not coerce its invocation result. Generated expression registries use this when a caller supplies no expected return type.- Returns:
- This expression when it is already uncoerced, or an uncoerced view
- Since:
- 1.0.1
-
getExpectedReturnType
- Returns:
- The expected return type
-
getExpectedParamTypes
- Returns:
- The expected parameter types
-
getExpressionString
- Specified by:
getExpressionStringin interfaceCompiledExpression- Specified by:
getExpressionStringin classjakarta.el.Expression- Returns:
- The original expression string
-
isLiteralText
public boolean isLiteralText()- Specified by:
isLiteralTextin classjakarta.el.Expression
-
equals
- Specified by:
equalsin classjakarta.el.Expression
-
hashCode
public int hashCode()- Specified by:
hashCodein classjakarta.el.Expression
-
equalityForm
- Specified by:
equalityFormin interfaceELExpressionIdentity- Returns:
- The bound parsed representation
-
toString
-