Annotation Interface JsExpression


@Documented @Target(METHOD) @Retention(RUNTIME) public @interface JsExpression
The JavaScript that a method of a JavaScript definition runs, as a constant expression.

The annotated method is called through Element.executeJs(Class). Its arguments are the parameters of the expression, referenced positionally as $0, $1, …, and the element the definition was obtained from is this ? the same contract as Element.executeJs(String, Object...), except that the expression is a constant of the interface instead of a string built at the call site.

A method that returns a JsSnippet is called through JsSnippets.of(Class) instead, and runs nothing when it is called. Its arguments are still $0, $1, …, but the expression is evaluated later by what the snippet is passed to, and this is whatever that invoker supplies. See JsFunctionParameterNames for the parameters it is called with.

Since:
25.4
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The JavaScript expression to run.
  • Element Details

    • value

      String value
      The JavaScript expression to run.
      Returns:
      the expression