commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: [BeanUtils] Mapped properties, this maybe a bug?
Date Mon, 20 Oct 2003 18:03:09 GMT
Thanks David for the response.

I guess then the real questions is why is the silent read-only assumption
the default behavior? Or why not keep looking for setters even after the
first one that comes up does not match the expected signature?

If the non-polymorphic behavior is required rather then convenient, then of
you have other conflicting signatures, maybe a log4j warning to save other
poor souls from hours of debugging?

Not that I require this at present, but I could see a situation where a
property has both mapped and scalar behavior especially in an index world,
ala prop(Name) and prop.config.address.

-----Original Message-----
From: Karr, David [] 
Sent: Monday, October 20, 2003 9:38 AM
To: Jakarta Commons Users List
Subject: RE: [BeanUtils] Mapped properties, this maybe a bug?

> -----Original Message-----
> From: []
> Hi Folks,
> Before I post I bug report I want to see the problem I face
> is really a bug.
> I have a struts application that uses a Mapped (Map) property
> for one of the
> form bean's property.
> If in the form bean I provide :
>     public Object getXXX(String key)
>     public void setXXX(String, key, Object value)
> mapped bean methods all works as it should. Both setting and
> getting values
> work as expected when accessing the property e.g 
> myform.XXX(key1) or setting
> it.
> If I add a the following method:
>     public Map getXXX()
> then my setter methods no longer work. After cranking up the
> Log4J error
> level I see that beanutils thinks that there are no setter 
> messages and that
> the property is read-only.

Properties are not "polymorphic".  A property is either a mapped property,
an indexed property, or a "scalar" property (I'm sure there's a better, more
correct term for this).  It can only be one of those.  If you need to access
data as a mapped property, and also access the map directly, then you'll
have to use two different property names, as you've discovered.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message