You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Rafael Muñoz Vega <rm...@tid.es> on 2003/09/25 15:33:31 UTC

DynaBeans/PropertyDescriptor

Hi, all.
I'm working in a application and i want to use DynaBeans and Introspection.
The current PropertyUtils not support DynaBeans in all the 
*PropertyDescriptors
methods (full of FIXME tags there :) ). I read a old thread 
(http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg05718.html)
in the dev-list about fixing it in the 1.1 version but it's seems that 
nobody do it. What's the status? Anyone have a pacht not released or 
anything?

Thanks.

-- 
Rafael Muñoz Vega

Email Personal: vega65@telefonica.net
Email Trabajo (TID): rmv35@tid.es



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: DynaBeans/PropertyDescriptor

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Rafael Muñoz Vega wrote:

>
> Hi, all.
> I'm working in a application and i want to use DynaBeans and 
> Introspection.
> The current PropertyUtils not support DynaBeans in all the 
> *PropertyDescriptors
> methods (full of FIXME tags there :) ). I read a old thread 
> (http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg05718.html) 
>
> in the dev-list about fixing it in the 1.1 version but it's seems that 
> nobody do it. What's the status? Anyone have a pacht not released or 
> anything?
>
> Thanks.
>
Although DynaBean properties don't show up in the property descriptors 
returned by PropertyUtils, such beans themselves are fully functional 
with the PropertyUtils getter and setter methods, as well as things like 
copyProperties().  Same thing goes for the BeanUtils methods that do the 
automatic type conversions for you as well.

My personal opinion is that it isn't worth the effort of trying to 
create fake descriptors, because there is no easy way to populate the 
readMethod and writeMethod properties -- a PropertyDescriptor assumes 
that each property on a bean has a getter method that takes no args, and 
a setter method that just takes a value, while DynaBeans do not have 
such things.

To introspect an object that you know is a DynaBean, call  
getDynaClass().getDynaProperties() instead and you'll get an array of 
DynaProperty objects, which is the DynaBeans version of property 
descriptors.

Craig



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org