Annotation Interface ELFunction


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface ELFunction
Declares a method as a Jakarta Expression Language function, with its own name and namespace prefix.

An annotated function is found by the expressions of the module it is declared in without any declaration; the functions of another module are listed with ELFunctions, which also exposes all the public static methods, and the public instance methods, of a class with no annotated method. Once a method of a class carries this annotation, only the annotated methods of the class are functions: a bean exposing one operation does not expose every public method it has.

A static function is invoked directly. An instance function is invoked on the instance the jakarta.el.ELContext provides at evaluation time, see io.micronaut.el.ELBeanProvider.

@Singleton
public class PricingService {

    @ELFunction(prefix = "pricing")
    public double quote(Book book, int quantity) { ... }
}
Since:
1.0
Author:
Denis Stepanov
  • Element Details

    • value

      String value
      Returns:
      The local name of the function, defaults to the method name
      Default:
      ""
    • name

      @AliasFor(member="value") String name
      Returns:
      The local name of the function, an alias of value()
      Default:
      ""
    • prefix

      String prefix
      Returns:
      The namespace prefix of the function, defaults to the prefix ELFunctions gives the class
      Default:
      ""