[jsr-314-open] EL property accessor name Forgiveness / Flexibility
Alaxander Smirnov
asmirnov at exadel.com
Thu Jul 23 00:30:20 EDT 2009
A setter method 'void' return value is a part of the JavaBean contract.
I guess that modification of the setter method pattern would also
confuse many other Java Bean libraries like apache-beanutils, some EJB
3.x containers and so on. I do not think what an one JSR specification
should violate any other, especially so wide used as JavaBeans are.
On 07/22/2009 04:07 AM, Pete Muir wrote:
> I'm with Lincoln here - sounds like an obvious, easy, improvement can
> be made to EL here...
>
> On 21 Jul 2009, at 23:12, Lincoln Baxter, III wrote:
>
>> I just ran across this when using the Builder pattern in some Pojos
>> -- each setter returns the current instance of the pojo to allow for
>> chaining set-statements:
>>
>> Pojo pojo = pojo.setName("name").setValue(23);
>>
>> With setters implemented like so:
>>
>> public Project setName(final String name)
>> {
>> this.name = name;
>> return this;
>> }
>>
>> But JSF complains:
>> javax.servlet.ServletException: javax.el.PropertyNotFoundException:
>> /faces/page.xhtml @36,20 value="#{pageBean.pojo.name}": Property
>> 'name' not writable on type java.lang.String
>>
>> It seems to me that this is a slightly harsh restriction. Is there
>> anything we can/should do about this? Does anyone else feel it's
>> worth mentioning?
>>
>> The obvious answer is to use dumb getter/setter methods, but in some
>> cases that can be restrictive, and I like the idea of being more
>> forgiving.
>>
>> Thoughts?
>>
>> --Lincoln
>
More information about the jsr-314-open-mirror
mailing list