Why does this function:
ConvertUtils.convert(String value, Class type)
require a String argument? All it does is dispatch to some Converter
that can take any Object, so this restriction seems unnecessary. It
causes callers to have to convert to string first which may sometimes
not be desirable.
In particular this seems to cause problems with BeanUtils.setProperty().
I asked the same question in a comment on this bug:
http://issues.apache.org/bugzilla/show_bug.cgi?id=16525
but I haven't heard anything.
Oh - while I'm asking, why do Converter objects bother taking a type
argument at all? None of the converters I looked at bother to use it -
they just assume they're converting to the type they were registered
for. If this usage is widespread, perhaps a new version without the type
argument ought to be created and the existing one deprecated.
Thanks,
Scott Howlett
|