On Fri, 18 Jan 2002, Diego Amicabile wrote:

> Date: Fri, 18 Jan 2002 13:30:18 +0100 (CET)
> From: Diego Amicabile <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: getMappedProperty in PropertyUtils
>
> Hi people,
>
> I am using Mapped Properties from the BeanUtils
> project in my web application. I have a bean which has
> both indexed properties and mapped Properties which
> have the same names, that is these are his public
> methods signatures :
>
>   public Object getObject(int index)
>   public Object getObject(String key)
>   public void setObject(int index, Object param)
>   public void setObject(String key, Object param)
>
> when I call the method
>
>   PropertyUtils.getMappedProperty(object,
> "property(key)")
>
> or
>
>   PropertyUtils.getMappedProperty(object,
> "property","key")
>
> the result is null, because in the method retrieves
> first the PropertyDescriptors without the mapped
> Descriptors.
> The property descriptor for the indexed property is
> found first and returned and since the method checks
> whether the descriptor is an instance of
> MappedPropertyDescriptor (which is not) the
> getObject(String) method is not called and null is
> returned (even if something is available)
> So the workaround  is giving the mapped properties
> names which do not conflict with the other properties.
> But I think the getMappedProperty should get FIRST the
> mapped property, so that
>
> property(key) and
> property[index] are both available when methods like
> the above described are defined in an object.
>
> How do you see it? Shouldn't the method
> getMappedProperty be modified?
>

I don't think so.

With standard JavaBeans properties, it's not legal to overload property
names this way (or by trying to have setters that take multiple proeprty
types), and we should treat mapped properties consistently.

> Greetings
> Diego
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to