commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [BeanUtils] ConvertUtils.convert too restrictive?
Date Wed, 27 Aug 2003 08:10:52 GMT
[convert] would be a whole subproject in commons dedicated to converting
objects to other objects (typically to and from strings).

Transformer (in [collctions] ) is one example of the kind of interface.
[functor] will have others. The point about [convert] would be that its
central interface would be conversion focussed. Hopefully [beanutils] could
then depend on [convert].

Of course, this is a pipedream at present as I don't have the time to kick
this off...

Stephen

----- Original Message -----
From: "Henri Yandell" <bayard@generationjava.com>
> I think it should.
>
> How is [convert] different to a Transformer?
>
> Hen
>
> On Wed, 27 Aug 2003, Stephen Colebourne wrote:
>
> > Maybe we should consider a new [convert] project at commons? Just a
thought.
> >
> > Stephen
> >
> > From: "robert burrell donkin" <robertburrelldonkin@blueyonder.co.uk>
> > To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
> > Sent: Tuesday, August 26, 2003 11:01 PM
> > Subject: Re: [BeanUtils] ConvertUtils.convert too restrictive?
> >
> >
> > > hi scott
> > >
> > > (you seem in a very argumentative mood. i'll try to avoid taking the
bait.
> > > )
> > >
> > > On Tuesday, August 26, 2003, at 09:57 PM, Scott Howlett wrote:
> > >
> > > > 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.
> > >
> > > i suspect that the reason for this is that ConvertUtils was designed
to
> > > handle string to object conversions (rather than object-to-object
ones).
> > > when examined from this perspective, the signature is very reasonable.
> > >
> > > > 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.
> > >
> > > the beanutils bug lists have a very large backlog.
> > >
> > > the issue boils down to the fact that ConvertUtils is design to
perform
> > > string-to-object conversions rather than more general object-to-object
> > > conversions. i'd say that the most satisfactory to solve both your
problem
> > > and the more general issue would be to subclass PropertyUtilBean or
add a
> > > pluggable strategy which would allow any compliant implementation to
be
> > > used.
> > >
> > > > 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.
> > >
> > > setting aside that this is not going to happen (due to backward
> > > compatibility issues), just because most people don't use a particular
> > > feature doesn't mean that it should be removed. i know that there are
> > > users who use this feature. whatever the faults that beanutils
exhibits,
> > > thankfully the code isn't so bloated yet that we need to consider
removing
> > > features used only by minorities.
> > >
> > > - robert
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


Mime
View raw message