commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Howlett" <>
Subject [BeanUtils] ConvertUtils.convert too restrictive?
Date Tue, 26 Aug 2003 20:57:50 GMT
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:

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.

Scott Howlett

View raw message