Interface ELMethod

All Superinterfaces:
Serializable

public interface ELMethod extends Serializable
A method resolved by an ELMethodExecutor.

The descriptor contains the metadata exposed by MethodExpression and the invocation itself. It deliberately has no java.lang.reflect dependency, so a service can implement it with a generated dispatch method or any other direct invocation mechanism.

Since:
1.1
Author:
Denis Stepanov
  • Method Summary

    Modifier and Type
    Method
    Description
    default io.micronaut.core.annotation.AnnotationMetadata
    Returns the method annotation metadata.
    io.micronaut.core.type.Argument<?>[]
    Returns the declared parameter types.
    Returns the method name.
    io.micronaut.core.type.Argument<?>
    Returns the return type.
    default String
    Returns the identity used when an expression containing a bound function is compared with another one.
    static String
    identity(Class<?> declaringType, String name, Class<?>[] parameterTypes)
    Builds the identity of a method in the form the compiler gives it, so that an expression parsed at runtime compares equal to the same expression compiled at build time.
    @Nullable Object
    invoke(jakarta.el.ELContext context, @Nullable Object base, Object @Nullable [] arguments)
    Invokes the method.
    default boolean
    Whether this method can be kept by the caller and invoked again.
    boolean
    Returns whether the method has a variable arity parameter.
    default Annotation[]
    Synthesizes the annotations required by the Jakarta EL method-reference API.
  • Method Details

    • getName

      String getName()
      Returns the method name.
      Returns:
      The method name
    • getReturnType

      io.micronaut.core.type.Argument<?> getReturnType()
      Returns the return type.
      Returns:
      The return type
    • getArguments

      io.micronaut.core.type.Argument<?>[] getArguments()
      Returns the declared parameter types.
      Returns:
      The declared parameter types
    • isVarArgs

      boolean isVarArgs()
      Returns whether the method has a variable arity parameter.
      Returns:
      Whether the method has a variable arity parameter
    • getAnnotationMetadata

      default io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
      Returns the method annotation metadata.
      Returns:
      The method annotation metadata, or empty metadata when there is none
    • synthesizeAnnotations

      default Annotation[] synthesizeAnnotations()
      Synthesizes the annotations required by the Jakarta EL method-reference API.
      Returns:
      The method annotations
    • invoke

      @Nullable Object invoke(jakarta.el.ELContext context, @Nullable Object base, Object @Nullable [] arguments)
      Invokes the method.
      Parameters:
      context - The EL context
      base - The instance, or null for a static method
      arguments - The arguments
      Returns:
      The result
    • isReusable

      default boolean isReusable()
      Whether this method can be kept by the caller and invoked again.

      A reusable method holds its signature and the code that runs it, and nothing of the call it was resolved for: the interpreter may then resolve a call site once and invoke the same method on every later evaluation, instead of resolving it again each time. A method that captured the arguments it was resolved with, or that only applies to their runtime types, is not reusable.

      The default is false, so an implementation is resolved again per call until it states otherwise. A method of an overloaded name is only reusable when the arguments cannot select a different overload.

      Returns:
      Whether the method can be invoked again with other arguments
    • identity

      default String identity()
      Returns the identity used when an expression containing a bound function is compared with another one. Implementations with overloads should include the declaring type in the identity.
      Returns:
      The method identity
      See Also:
    • identity

      static String identity(Class<?> declaringType, String name, Class<?>[] parameterTypes)
      Builds the identity of a method in the form the compiler gives it, so that an expression parsed at runtime compares equal to the same expression compiled at build time.
      Parameters:
      declaringType - The type declaring the method
      name - The name of the method
      parameterTypes - The declared parameter types
      Returns:
      The method identity