You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2025/01/07 14:07:01 UTC
[jira] [Updated] (BEANUTILS-403) ConvertUtilsBean should allow registering Converters with source class
[ https://issues.apache.org/jira/browse/BEANUTILS-403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated BEANUTILS-403:
--------------------------------------
Fix Version/s: 2.0.0-M2
(was: 2.0.0-M1)
> 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
> Components: ConvertUtils & Converters
> Affects Versions: 1.8.3
> Reporter: Michael Vorburger
> Priority: Major
> Fix For: 2.0.0-M2
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)