ConvertUtilsBean should allow registering Converters with source class
----------------------------------------------------------------------

                 Key: BEANUTILS-403
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-403
             Project: Commons BeanUtils
          Issue Type: Improvement
            Reporter: Michael Vorburger
         Attachments: ConversionBeanUtilsBugTest.java

ConvertUtils should allow registering Converters not only with destination 
class, but with destination AND with source class.

In addition to the void register(Converter converter, Class clazz) method, 
there should also be a register(Converter converter, Class sourceClass, Class 
destinationClass).  The implementation in Converter lookup(Class sourceType, 
Class targetType), which currently in the last line just does return 
lookup(targetType), should look for a Converter registered with both targetType 
& sourceType (if any).

This would allow something like the attached example (Test case) to work, where 
I'd like to register a Converter which can turn A into B, as well as another 
Converter which can turn into Object into B (imagine B being something like a 
DynaBean) - this is not currently possible, but would be useful.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to