commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <>
Subject Re: [convert] API Discussion...
Date Fri, 04 Nov 2011 09:18:22 GMT
Hi James,
I had a look at current [convert] impl and the (source|target)Class
are used to index converters inside a generic universal converter, so
all you have to do is invoking just one method to perform conversions
- without retrieving the converter you need on your client
Your hints are more or less what I had in my mind too, after you
suggested having fluent APIs in the Digester I'm kind of addicted to
them :P
I'd suggest to replace the (source|target)Class settings by hand
applying the `TypeLiteral` pattern explained in Neal Gafter's post[1]
to auto-discover them.
Have a nice day, all the best!


On Fri, Nov 4, 2011 at 3:19 AM, James Carman <> wrote:
> I was taking a look at the [convert] component because I have done
> some work lately on some handy conversion classes.  I'm struggling to
> understand why you'd need the getSourceClass() and getTargetClass()
> methods if you're using generics.
> Also, I've got a class that looks like this:
> public class ConverterChain<S,T> implements Converter<S,T>
> {
>  public static <S> ConverterChain<S,S> from(Class<S> sourceType);
>  public <N> ConverterChain<S,N> append(Converter<T,N> converter);
>  ...
> }
> I'd like to contribute it, but in my library, I don't have all of
> those references to the class objects (source/target).  I might check
> it in without the source/target stuff implemented.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message