[el-spec users] [jsr341-experts] Re: Type coercion in EL
- From: Mark Thomas <markt@...>
- To: jsr341-experts@...
- Subject: [el-spec users] [jsr341-experts] Re: Type coercion in EL
- Date: Mon, 07 May 2012 19:53:20 +0100
- List-id: <jsr341-experts.el-spec.java.net>
On 24/04/2012 20:06, Kin-man Chung wrote:
> Dear experts,
> There have been several requests for changing the coercion rules in EL,
> when the sources is a null or an empty string. See
> I think we should address this issue in EL 3.0.
> Specifically, we should make the distinction between a target type of
> say int vs. Integer. A null should be coerced to a 0 in the formal
> case, and remains a null in the later.
> Similarly, if the target is a String, a null should not be coerced to
> "", but should remains a null.
> This would break backward compatibility, but nobody seems to want the
> current behavior, and this is really a bug.
As long as there is a way for folks who actually want the current
behaviour revert to it without re-writing their entire app then I am
fine with this change.
> We have also introduced custom pluggable type converter in EL 3.0. The
> currently proposal adds a new field in the ELContext. Though it would
> work, I am leaning more to adding a new method in the ELResolver, such as
> Object converType(Object obj, Class<?> targetType);
> The reason for putting it in the ELResolver is that it allows for
> addition of multiple ELResolvers to handle multiple custom type
> converters, and that ELResolver seems to be a more suitable home for it.
> If there are comments or questions, please let me know.