commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sumit S." <>
Subject RE: Transferring Data from ValueObjects into DynaBeans
Date Mon, 10 Nov 2003 18:23:11 GMT
   Went thru the source code of the WrapDynaBean...Does the same thing as what I am doing
here but additionally supports indexed & mapped properties...So makes sense to use the

Thanks again

-----Original Message-----
From: Craig R. McClanahan []
Sent: Monday, November 10, 2003 10:49 PM
To: Jakarta Commons Users List
Subject: Re: Transferring Data from ValueObjects into DynaBeans

Quoting "Sumit S." <>:

> Hi,
>    Is there a standard way of describing the DynaProperty array for creating
> a DynaBean into which I can populate data from a Value Object using
> PropertyUtils.copyProperties (...)
>   For eg, when we are getting data from a resultset and use the
> ResultSetDynaClass
>    BasicDynaClass bdc = new BasicDynaClass("foo", BasicDynaBean.class,
> rsdc.getDynaProperties());
>  Is there a way to set the DynaProperties of the DynaBean when bringing the
> data over from a ValueObject (Say a struts based action form)
>   What I have done as of now, is implemented a piece of code to introspect
> the ActionForm and create an array of DynaProperty objects that I am passing
> to the BasicDynaClass structure.
> 				propertyDescriptor = propertyDescriptors[i];		 
> 				propertyType = propertyDescriptor.getPropertyType();				
> 				propertyName = propertyDescriptor.getName();			
> 				dynaProperty = new DynaProperty(propertyName, propertyType);
> Add all the dynaProperty Objects to an array and pass it to the
> constructor....
> Is there another way ?

If you just want to copy the properties of your transfer object to set up a new
DynaClass, check out the WrapDynaBean class.

  MyValueObject mvo = ...;
  DynaBean dynabean = new WrapDynaBean(mvo);

> Thanks
> Sumit


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

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

View raw message