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
application.
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!
Simo

[1] http://gafter.blogspot.com/2006/12/super-type-tokens.html

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Fri, Nov 4, 2011 at 3:19 AM, James Carman <ja...@carmanconsulting.com> 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: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to