You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to explicitly coerce the return value from a script.
Runtime fields want to avoid returning `Object` from the execute method
in each context. Instead, they will return an array of primitive
objects, such as `long[]`.
However, it's convenient to allow a user to return a single primitive
type rather than allocating a length-one array.
To achieve this, an implementer can add explicit conversion functions to
a context with signature:
`public static <context-return-value> convertFrom<Suffix>(<any type>)`
When a user returns a type other than the context return value, at
compile-time, painless will insert a call to their `convertFrom` method.
This commit is Phase 1 of this work. It handles explicit converters for
all painless types EXCEPT def type.
Refs: elastic#59647
0 commit comments