commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [BeanUtils] PropertyUtils and DynaBeans (getPropertyDescriptors)
Date Wed, 17 Apr 2002 19:56:46 GMT


On Wed, 17 Apr 2002, Stephen Colebourne wrote:

> Date: Wed, 17 Apr 2002 20:35:36 +0100
> From: Stephen Colebourne <scolebourne@eurobell.co.uk>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: Re: [BeanUtils] PropertyUtils and DynaBeans
>     (getPropertyDescriptors)
>
> > I did think a standard wrapper around the Introspector would be a good
> idea
> > ...
> > Though I guess the static methods of PropertyUtils actually are this
> wrapper.
> > PropertyUtils.getPropertyDescriptors(bean);
> > PropertyUtils.getMappedPropertyDescriptors(bean);
>
> > Also DynaBeans right now can't support beans PropertyDescriptors,
> presumably
> > because its not possible to implement read & write Methods.
>
> Hmm. The PropertyDescriptors for DynaBeans would indeed be pretty empty, so
> I guess you are right.
>
> > Though maybe another idea is to treat everything as a DynaBean.
> > So maybe DyanBean could actually become the wrapper around the
> introspector?
> > This approach would then supports beans, DynaBeans, mapped properties and
> so
> > forth in a simple consistent manner.
> > ...
> > Also WrapDynaClass instances are cached so all in all the approach of
> using
> > DynaBeans all the time as a bean/Introspector replacement seems like a
> good
> > idea. So if you're not being typesafe, using DynaBeans seems like the way
> to
> > go. DynaBeans rock ;-)
>
> Intriguing. Overall the realatively small DynaBean interface probably does
> cover the requirements for getting and setting data from a 'bean'. There
> doesn't seem to be any way to use the one.two[0].three(four) type syntax
> however. Maybe this could be added.
>

It's already there, but not in the DynaBeans themselves ... :-)

The property getter/setter methods in PropertyUtils and BeanUtils work on
either standard JavaBeans or on DynaBeans, so you can use the exact same
property syntax on them.

> Stephen

Craig


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message