Interface ELMethodExecutor

All Superinterfaces:
io.micronaut.core.order.Ordered
All Known Implementing Classes:
CommonELResolver, ContributedELMethodExecutor, ExecutableMethodELExecutor, IntrospectionELResolver, ReflectiveELMethodExecutor, StreamELResolver

public interface ELMethodExecutor extends io.micronaut.core.order.Ordered
Resolves and executes methods for expressions parsed at runtime.

Implementations are discovered as services by the interpreter. A provider can use generated code, a registry, or another direct dispatch mechanism. Reflection is intentionally not part of this contract; it is supplied separately by the optional interpreter-reflection module, whose executor says so with isReflective().

Since:
1.1
Author:
Denis Stepanov
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    Returns the executor order.
    default boolean
    Whether the executor reaches the methods it resolves reflectively, rather than through what was generated or registered while the application compiled.
    @Nullable ELMethod
    resolve(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, io.micronaut.core.type.Argument<?> @Nullable [] argumentTypes, Object @Nullable [] arguments)
    Resolves an instance or static method, or a constructor represented by <init>.
    default @Nullable ELMethod
    resolveFunction(jakarta.el.ELContext context, String prefix, String localName)
    Resolves a function bound by the expression context.
  • Method Details

    • isReflective

      default boolean isReflective()
      Whether the executor reaches the methods it resolves reflectively, rather than through what was generated or registered while the application compiled. The ELSandbox of an expression parsed at runtime is consulted for the methods such an executor resolves, and only for them.
      Returns:
      Whether the executor reflects, false by default
    • getOrder

      default int getOrder()
      Returns the executor order. Lower values run first, following the Micronaut Ordered contract, so direct/generated implementations can take precedence over a general fallback such as reflection.
      Specified by:
      getOrder in interface io.micronaut.core.order.Ordered
      Returns:
      The order, zero by default
    • resolve

      @Nullable ELMethod resolve(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, io.micronaut.core.type.Argument<?> @Nullable [] argumentTypes, Object @Nullable [] arguments)
      Resolves an instance or static method, or a constructor represented by <init>.
      Parameters:
      context - The EL context
      base - The instance, or an ELClass for a static method or constructor
      method - The method name
      argumentTypes - The parameter types supplied when the method expression was created, or null
      arguments - The evaluated arguments, or null
      Returns:
      The resolved method, or null when this executor does not handle it
    • resolveFunction

      default @Nullable ELMethod resolveFunction(jakarta.el.ELContext context, String prefix, String localName)
      Resolves a function bound by the expression context.

      The default implementation does not contribute functions. A reflection-backed implementation can use the Jakarta FunctionMapper here, while a generated implementation can provide functions without exposing reflective methods.

      Parameters:
      context - The EL context
      prefix - The function prefix
      localName - The function name
      Returns:
      The resolved function, or null when this executor does not handle it