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 Details

    • CompiledMethodExpression

      protected CompiledMethodExpression(String expressionString, @Nullable Class<?> expectedReturnType, Class<?> @Nullable [] expectedParamTypes, boolean parametersProvided)
      Parameters:
      expressionString - The original expression
      expectedReturnType - The expected return type, or null to return the result without coercion
      expectedParamTypes - The expected parameter types
      parametersProvided - 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 expression
      canonicalForm - The canonical form of the expression, which is what equality compares
      expectedReturnType - The expected return type, or null to return the result without coercion
      expectedParamTypes - The expected parameter types
      parametersProvided - Whether the parameters are provided by the expression itself
  • Method Details

    • evaluateBase

      protected abstract @Nullable Object evaluateBase(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.
      Parameters:
      context - The context
      Returns:
      The base object
    • evaluateProperty

      protected abstract @Nullable Object evaluateProperty(jakarta.el.ELContext context)
      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 context
      arguments - The arguments passed to invoke(ELContext, Object[])
      Returns:
      The result of the invocation, before the coercion to the expected return type
    • evaluateArguments

      protected Object @Nullable [] evaluateArguments(jakarta.el.ELContext context)
      Evaluates the parameters an expression such as ${bean.method(a, b)} provides itself.
      Parameters:
      context - The context
      Returns:
      The evaluated parameters, null for an expression that does not provide them
    • invoke

      public @Nullable Object invoke(jakarta.el.ELContext context, Object @Nullable [] params)
      Specified by:
      invoke in class jakarta.el.MethodExpression
    • getMethodInfo

      public jakarta.el.MethodInfo getMethodInfo(jakarta.el.ELContext context)
      Specified by:
      getMethodInfo in class jakarta.el.MethodExpression
    • getMethodReference

      public jakarta.el.MethodReference getMethodReference(jakarta.el.ELContext context)
      Overrides:
      getMethodReference in class jakarta.el.MethodExpression
    • isParametersProvided

      public boolean isParametersProvided()
      Overrides:
      isParametersProvided in class jakarta.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

      protected Class<?> getExpectedReturnType()
      Returns:
      The expected return type
    • getExpectedParamTypes

      protected Class<?>[] getExpectedParamTypes()
      Returns:
      The expected parameter types
    • getExpressionString

      public final String getExpressionString()
      Specified by:
      getExpressionString in interface CompiledExpression
      Specified by:
      getExpressionString in class jakarta.el.Expression
      Returns:
      The original expression string
    • isLiteralText

      public boolean isLiteralText()
      Specified by:
      isLiteralText in class jakarta.el.Expression
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class jakarta.el.Expression
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class jakarta.el.Expression
    • equalityForm

      public final String equalityForm()
      Specified by:
      equalityForm in interface ELExpressionIdentity
      Returns:
      The bound parsed representation
    • toString

      public String toString()
      Overrides:
      toString in class Object