Thanks for the tip, Jesse. That is not exactly what I am looking for,
but I know about the type erasure limitations. I too tried with a
provider method, with no success, of course:

@Provides
<From, To> Filler<From, To> provideFiller(TypeLiteral<From> from,
TypeLiteral<To> to){
   return new DefaultFiller(from, to);
}

Guice does awesome job by hiding the type erasure. I am waiting for
more punches to type erasure in the next releases.
Thanks a lot.
Regards.

- Andrés


On 6 jul, 20:55, "[email protected]" <[email protected]> wrote:
> On Jul 6, 2:03 pm, Andrés Testi <[email protected]> wrote:
>
> > ... and now Filler has a default binding from DefaultFiller to
> > Filler ...
> > @ImplementedBy(DefaultFiller.class)
> > public interface Filler<From, To> {
> >  ....
> > }
>
> @ImplementedBy doesn't support parameterized types. When you say
> @ImplementedBy(DefaultFilter.class), that uses the raw DefaultFilter
> type, which doesn't have the required type parameters. Instead, you'll
> need to create separate bindings for each From/To pair:
>   bind(new TypeLiteral<Filler<String, Date>>() {})
>       .to(new TypeLiteral<DefaultFilter<String, Date>() {});
>   bind(new TypeLiteral<Filler<Integer, Date>>() {})
>       .to(new TypeLiteral<DefaultFilter<Integer, Date>() {});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to