|
From: Peter d. H. <pe...@de...> - 2003-10-24 10:52:41
|
Juergen wrote:
> The question is: When and how to we add support for indexed and mapped
properties?
> I guess that if we do, we should adopt the Commons BeanUtils style of
specifying property
> paths for index and map access.
I disagree. I feel we should use (a subset of) the JSTL Expression Language
(EL) syntax as our starting point rather than BeanUtils style syntax. Please
consider that this EL will be part of JSP itself as of version 2.0 of the
spec; why introduce another language into the mix? If in a JSP you say
${foo.bar}, shouldn't you be able to name the corresponding field foo.bar
rather than foo(bar)?
For simple and indexed properties, users won't notice any difference anyway.
The most important differences are that the precise meaning of a[b] is
determined by whether "a" evaluates to a List or a Map, and that a.b is
fully equivalent to a["b"]. BeanUtils-style mapped properties (i.e. a(b))
aren't part of the EL; they could be supported in a compatible way but IMHO
stick with core JavaBeans stuff -- do this only if we can come up with a
compelling use case for it.
And if this is being refactored anyway, it's probably worth taking a look at
what would be involved in making the EL implementation pluggable.
- Peter
|