[morph-user] Re: BeanUtils patch
Brought to you by:
orangeherbert,
sgarlatm
|
From: Matt S. <sga...@us...> - 2005-04-26 18:59:39
|
Hi Nathan, Thanks for evaluating Morph! A boolean flag in the PropertyNameMatchingCopier indicating whether transiesnt properties should be copied is an interesting idea. Would you mind describing how you would use such a property? Morph does not distinguish transient from non-transient properties or static from non-static properties. The main reason for this is that these notions don't make sense when you start treating other objects such as Maps and HTTP request parameters the same way as you treat Objects. Maps and HTTP request parameters don't have any notion of transient or static properties. I think the easiest way to accomodate your requirement would be to add a getPropertiesToCopy(Object destination, Object source) method to the PropertyNameMatchingCopier that by default delegated to getPropertiesToCopy(). That way, in a subclass you could override the getPropertiesToCopy method and scan the source object to determine which properties are transient. Alternatively, if you're only dealing with a couple transformations you could just specify the propertiesToCopy statically by calling the setPropertiesToCopy method. I will definitely be adding the getPropertiesToCopy(Object destination, Object source) method in the next version of Morph. If you like, I can do a release for you soon that includes this method. Matt negge wrote: >Matt, > >I was just experiencing some frustration with BeanUtils and thought I'd take a >look at the Morph package. I was hoping the PropertyNameMatchingCopier had >the ability to allow you to specify a boolean indicating whether or not it >should copy member variables that are marked as transient. This functionality >exists in the EqualsBuilder, HashCodeBuilder, ToStringBuilder so you can mark >primary keys or Collection objects as transient and they will not be used in >computing the hashcode or equality of two objects. > >I'd hope to see it implemented so I could just execute > > copy(user,userForm,false); > >and have it work. > >Thanks for creating a very useful looking library. > >Nathan > > > >>===== Original Message From Matt Sgarlata <sga...@us...> >> >> >===== > > >>Hi Nathan, >> >>I noticed the patch you submitted to BeanUtils. If you're anything like >>me, you're starting to reach the point of frustration with the package. >>I discovered that as long as I did exactly what BeanUtils was designed >>to do, I didn't run into any problems. However, as soon as I tried to >>customize things for my application I ran into serious problems. >> >>This led me to create a similar framework that is much more configurable >>and flexible than BeanUtils. I encourage you to check it out at >>morph.sourceforge.net. It is in late beta and already offers pretty >>much all of the features of BeanUtils. Hopefully it can help you solve >>some of your problems! >> >>Matt >> >> > > > > > |