Interface ELProxyFactory

All Known Implementing Classes:
ReflectiveELProxyFactory

@Internal public interface ELProxyFactory
Implements a functional interface nothing described in advance, which is the last resort of the coercion of the section 1.23.2 of the specification.

The coercion needs the single abstract method of the target interface. The functional interfaces of the platform are implemented by this module directly, and an application declares its own to ELMethodRegistry.functionalInterface(Class, ELMethodRegistry.Lambda), so neither reaches here. What does is an interface no one named, which can only be implemented by discovering its method at runtime: that is reflection, so it is contributed by the interpreter-reflection module rather than performed here.

An application implements ELMethodContributor rather than this. Without a factory on the classpath the coercion does not apply, and a lambda expression reaching a parameter of an undescribed functional interface type is reported as a failed coercion.

Since:
1.1
Author:
Denis Stepanov
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    create(@Nullable jakarta.el.ELContext context, jakarta.el.LambdaExpression lambda, Class<T> type)
    Implements the functional interface with the lambda expression.
    boolean
    Whether the given type is a functional interface this factory can implement.
  • Method Details

    • isFunctionalInterface

      boolean isFunctionalInterface(Class<?> type)
      Whether the given type is a functional interface this factory can implement.
      Parameters:
      type - The target type
      Returns:
      Whether the type is a functional interface
    • create

      <T> T create(@Nullable jakarta.el.ELContext context, jakarta.el.LambdaExpression lambda, Class<T> type)
      Implements the functional interface with the lambda expression.
      Type Parameters:
      T - The functional interface
      Parameters:
      context - The context, or null when the lambda carries its own
      lambda - The lambda expression
      type - The functional interface
      Returns:
      The instance