On Fri, 7 Jun 2002, Sharma, Sanjay (LNG) wrote:

> Date: Fri, 7 Jun 2002 11:51:27 -0400
> From: "Sharma, Sanjay (LNG)" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: PropertyUtils.describe and DynaBeans
>
>
> I would like to use the describe method to populate a hash map from a Dyna
> bean. This method uses getPropertyDescriptors which javadoc & release notes
> state don't work with DynaBeans. What is the time frame (if any) for making
> getPropertyDescriptor methods work with DynaBeans.
>

There are some pretty significant challenges in getting this to work -- in
particular, a PropertyDescriptor wants to include a Method for the
property getter and setter methods, but the signatures won't match the
JavaBeans design patterns.

An alternative way to introspect a DynaBean is like this:

  DynaBean myDynaBean = ...;
  DynaClass myDynaClass = myDynaBean.getDynaClass();
  DynaProperty myDynaProps[] = myDynaClass.getDynaProperties();

Each dynamic property has a small descriptor that includes the name and
type of the underlying property.  This will work on any correctly
coded DynaBean implementation (including, for example, DynaActionForm).

> Thanks,
>
> Sanjay

Craig


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

Reply via email to