[jsr-314-open] EL property accessor name Forgiveness / Flexibility

Lincoln Baxter, III lincolnbaxter at gmail.com
Tue Jul 21 18:12:46 EDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20090721/93e87508/attachment.html 


More information about the jsr-314-open-mirror mailing list