commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [beanutils] BeanUtils.copyProperties support for non-simple properties...?
Date Sun, 01 Dec 2002 19:58:34 GMT

On Saturday, November 30, 2002, at 04:39 PM, Craig R. McClanahan wrote:

>
>
> On Thu, 28 Nov 2002, robert burrell donkin wrote:
>
>> Date: Thu, 28 Nov 2002 20:07:09 +0000
>> From: robert burrell donkin <robertburrelldonkin@blueyonder.co.uk>
>> Reply-To: Jakarta Commons Developers List <commons-
>> dev@jakarta.apache.org>
>> To: Jakarta Commons Developers <commons-dev@jakarta.apache.org>
>> Subject: [beanutils] BeanUtils.copyProperties support for non-simple
>>     properties...?
>>
>> the following bug http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14470
>> boils down to copyProperty calling setSimpleProperty rather than
>> setProperty. since this is (just) in the java docs, i'm reluctant to
>> change this in case there's a good reason why it was written like this.
>>
>> does anyone know a reason why it was done like this?
>
> The original intent was to perform a "shallow copy" of the properties in
> an origin bean to a destination bean, in a manner reminiscent of what the
> java.lang.Object.clone() method is supposed to do.

ok. that makes sense.

> The issue of non-simple properties only matters for a Map as the source
> (and, if we add it, a Map as the destination).  This is one of the places
> I'm not clear what makes the most sense in our seeming quest to treat Maps
> like beans for some purposes.

agreed.

i think that maybe we're being pushed into this by user demands. (i 
certainly don't have any agenda in this area.) we need to think careful 
and make sure that we're not being pushed into poor design choices.

i've looked again at the original java docs and the simple copying is 
specified as part of the method specification. the bug report should 
probably be marked as WONTFIX.

> Maybe the best thing to do would be to separate out the copy-from-map
> operation into a separate method that complements describe()?  Such a
> method could easily support non-simple properties -- it would be a generic
> way to load properties into an entire existing tree.

+1

(we'd need to leave the existing (simple) copy-from-map functionality in 
copyProperties.)

if you're short of cycles, i can probably take a look at implementing this.

- robert


--
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