Hi All,
This ones a little complex (for me anyway). I have a class that
requires both a generic argument, and a Class<T> of that generic type
as a constructor arg.
Easiest to explain with code:
//Supplier, of 'S'.... and it needs Class<S> to do its job
public abstract class Shop<S> {
public Shop(Class<S> classOfS){ ... }
}
//FerrariShop is a Shop, but it only supplies Ferrari's...
public class FerrariShop<F extends AbstractFerrari<?>> extends Shop<F>
{
@Inject
public FerrariShop(Class<F> classOfF, Blah blah){ //Note blah is
injected too...
super(classOfF);
}
}
Then my FastDriver needs to be @Inject'd with a
'Provider<FerrariShop<EnzoFerrari>>.....
@Inject
public FastDriver(Provider<FerrariShop<EnzoFerrari>>
enzoFerrariShopProvider) {}
I'm a little lost here, so THANKS for helping me if you can :)
p.s. if you are wondering why I am doing this, I am building a
hierarchy of http requests. Gson is de/serializing the request/
response and it needs to know Class<F> for its serialization. For
reliability I want this to be a constructor arg. Also, Gson is
fantastic (kudos++)!
--
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.