Is there a way to inject a class type Class<T>
in gin? I can't seem to get it working, for example:
class GenericFoo<T> {
private final Class<T> klass;
@Inject
public GenericFoo(Class<T> klass) {
this.klass = klass;
}
}
class Bar { }
with an instance injected somewhere:
..
@Inject
GenericFoo<Bar> instance;
..
and a GinModule containing something along the lines of:
bind(new TypeLiteral<Class<Bar>>() {}).to(Bar.class);
Thanks