commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [Betwixt] Mapping Beans to Beans
Date Mon, 16 Aug 2004 22:03:51 GMT
On 16 Aug 2004, at 22:03, Garsombke, Franz wrote:

<snip>

> >>you can't use betwixt to map beans to beans (IMHO that's Franz's 
> point :)

> Yep. I am amazed that I haven’t found any framework to do this.

there are bits and pieces around the place that offer partial solutions 
but AFAIK nothing comprehensive...

> >>i'm not an expert on proxy's but AIUI (java) proxy's can only be 
> used to create dynamic implementations for interfaces. i don't really 
> see how this >>helps the problem of mapping beans-to-beans. IMHO there 
> are several more-or-less well known methods by which the actual gluing 
> can be performed (source >>generation, reflection, bytecode) but the 
> real magic is in creating an expressive but concise way to specifying 
> the mappings.

> Yes. A mapping like below:
> <mapping classOne=”VO1” classTwo=”VO2”> Bi-directional
>   <property1=”errorMessage” property2=”errorMSG”/> Property names are

> different
>   <property1=”MyResults” property2=”YourResults”/> Nested Objects: 
> Arrays of Results
>   </default> Will do a PropertyUtils.copyProperties() and catch all 
> the generic properties that are named the same on both objects
> </mapping>
>
> Nice things to have: default values, conversion (int to String, etc.)

conversions are a nice little problem :)

> I have been looking at some code in-house and they spend hundreds or 
> thousands of line of code doing simple/stupid Value Object 
> conversions.

+1

>  >>it seems to me that's there are plenty of lessons that can be learn 
> from betwixt for a beans-to-beans mapping tool but it'd probably not 
> be betwixt. in >>some ways it's an easier problem than mapping beans 
> to xml and it'd probably be possible to have a reasonably featured 
> implementation relatively >>quickly...
>

> I agree. I will probably use the beanutils package.

(as it works at the moment) there are major limitations on what 
beanutils can do in this area. it's language isn't very expressive and 
lacks the strategies that allow betwixt to make informed guesses at 
mappings. now that the beanification changes are in, i think that there 
would be definite benefits in creating a stand alone mapper together 
with a bridging beanutilbean implementation (so that it would be used 
with struts etc) rather than trying to improve beanutils in this 
direction.

- robert

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


Mime
View raw message