commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Digulla <digu...@hepe.com>
Subject Re: [BeanUtils] Error-checking BeanUtils.copyProperties() using Levensthein distance
Date Wed, 22 Nov 2006 19:50:47 GMT
Olivier Pernet wrote:

>> Not quite sure what copyProperties currently does, but I'd be happy to
>> consider improving the logging messages - but I wouldn't want to
>> either a) add a dependency on Commons Lang for this (as both are
>> widely used libraries and could present users with version issues) or
>> b) burden beanutils with the maintenance of additional Levenshtein code
>> for what I see as minimal benefit.
> 
> It doesn't log anything right now. Which may be better, as some users
> probably make intensive use of it, and wouldn't want their logs to be
> cluttered with this. And actually I wouldn't want it to log when a
> property is not found : it's quite common to copy properties from a
> source bean that has more properties than the destination bean, as
> when you copy data from a domain object to a DTO.

This calls for a mode switch, doesn't it? Like:

LOG_NO_SOURCE - Log if a property only exists on the destination side

LOG_NO_DEST - Log if a property only exists on the soucre side

LOG_BOTH - Log either

LOG_NONE - As it is now.

Or, even more flexible, add a callback method which gets called if one
side is missing, like: missing(sourceBean, sourceProperty, destBean,
destProperty).

The missing property will be null.

This would allow to inject Levenstein-Distance error handling if someone
needs it.

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://www.philmann-dark.de/


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


Mime
View raw message