Annotation Interface ELExpression


Declares a Jakarta Expression Language value expression to be compiled at compilation time.

A jakarta.el.ValueExpression implementation is generated for the expression, so that no parsing, no abstract syntax tree traversal and, whenever the types are known, no reflective resolution happens at runtime.

An expression declared on a field, a method or a parameter is compiled into the registry of the declaring class, exactly as one declared on the class itself. This is how an annotation processor routes the expressions of other annotations, which live on the members, to the compiler.

Since:
1.0
Author:
Denis Stepanov
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The expected type the evaluation result is coerced to.
     
     
    The expression, which can be an eval-expression such as ${user.name}, a literal-expression or a composite expression as defined by the Jakarta Expression Language specification.
  • Element Details

    • value

      String value
      The expression, which can be an eval-expression such as ${user.name}, a literal-expression or a composite expression as defined by the Jakarta Expression Language specification.
      Returns:
      The expression
      Default:
      ""
    • expression

      @AliasFor(member="value") String expression
      Returns:
      The expression, an alias of value()
      Default:
      ""
    • expectedType

      Class<?> expectedType
      The expected type the evaluation result is coerced to. When it is not declared, the compiler infers it from the static type of the expression: ${book.discounted(10)} is a Double because discounted returns one, and an expression whose type the compiler does not know is an Object. The generated ExpressionFactory then serves the expression for the inferred type and for Object.class.
      Returns:
      The expected type
      Default:
      java.lang.Object.class
    • name

      String name
      Returns:
      The name of the generated constant, derived from the expression when not specified
      Default:
      ""