[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [el-dev] Question about the new OptionalELResolver
|
On 20/02/2024 16:21, Arjan Tijms wrote:
Hi,
I've been following this discussion here, and recognize the importance
of the current concerns.
We do have to remember that we have really little time remaining to
resolve this. Expression Language is up for review at the end of this month:
See https://www.eclipse.org/lists/jakartaee-platform-dev/msg04409.html
<https://www.eclipse.org/lists/jakartaee-platform-dev/msg04409.html>
Yep. I'm aware of that. I should have a PR for this later today.
Mark
Kind regards,
Arjan Tijms
On Tue, 20 Feb 2024 at 12:43, Mark Thomas via el-dev <el-dev@xxxxxxxxxxx
<mailto:el-dev@xxxxxxxxxxx>> wrote:
On 13/02/2024 15:31, Paul Nicolucci wrote:
> Hey Mark,
>
> Your proposal seems reasonable to me!
I've started to look at implementing this in Tomcat and have found a
complication. Consider the following expression:
${beanA.beanBOpt.map(b -> b.name <http://b.name>)}
Should this call Optional.map() which is likely what was intended or
should it call Optional.get().map() which will probably throw a
MethodNotFoundException
I think the answer is that the user has to choose.
Choice A: Don't use OptionalELResolver
Instances of Optional are treated like any other object. The expression
above will trigger a call to Optional.map() and return a (possibly
non-empty) Optional.
Choice B: Use OptionalELResolver
Instances of Optional are treated as Optional.get() if present and null
if empty (and any property or method on the Optional is ignored). The
expression above will return null if the Optional is empty. If the
Optional is present then the expression will return the result of
calling Optional.get().map() which may return a value or may throw a
MethodNotFoundException
I'm going to continue my work in Tomcat on this basis and see where
things end up.
Mark
_______________________________________________
el-dev mailing list
el-dev@xxxxxxxxxxx <mailto:el-dev@xxxxxxxxxxx>
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/el-dev
<https://www.eclipse.org/mailman/listinfo/el-dev>