Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-187

[beanutils] Methods ConvertUtilsBean.convert could check for converters registered with base classes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 19857

    Description

      When converting a value to a class instance it is possible tu register user
      defined classes that implement the converter interface.
      The method convert(String value, Class clazz) in ConvertUtilsBean tries to get
      an instance of a converter class simply by checking the collection of registered
      converters.
      Unfortunately converters that have been registered for super classes are not
      considered.
      REQUEST: How about improving the method convert by the following code lines:

      Class baseclazz = clazz;
      Converter converter = null;
      do {
      converter = (Converter) converters.get(baseclazz);
      if (converter != null)
      break;
      baseclazz = clazz.getSuperclass();
      } while (baseclazz != null);

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              abo@mid.de Alexander Borschet
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: