commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Rood <wes9...@myfastmail.com>
Subject BeanUtils
Date Fri, 14 Nov 2003 21:07:17 GMT
What is the best way to code a custom Converter for use with 
ConvertUtils.register() while still achieving the default conversion 
logic provided when you call BeanUtils.copyProperties()?

I want to provide my own logic for going from Boolean to String, but I 
want the default behavior for all types other than Boolean.  When I 
register my custom converter, it is based on the output type, not the 
output type - input type combination, so my converter runs for Boolean 
as well as all the other types in the java language.

This can be solved by repeating the logic performed by the default 
StringConverter, but it seems silly to do so.

Here are 3 possible solutions:

1 Allow the default converters to be overridden

2. Run the custom converters in addition to the default converters

3. Allow custom converters to be registered based upon the input type - 
output type combination, not just output type

Any ideas?


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