Suppose we supported just-in-time bindings for instances of TypeLiteral:
@Inject TypeLiteral<String> stringType;
@Inject List<Map<Integer, Short>> listOfMapType;
In this case, we'd inject the TypeLiteral.get(String.class) and
TypeLiteral.get(Types.mapOf(Integer.class, String.class)) respectively. This
requires a special case
for injecting TypeLiterals. It gets interesting is when we combine this type
parameter matching.
Consider:
class Foo<T> {
@Inject TypeLiteral<T> myTypeParameter;
@Inject TypeLiteral<Foo<T>> myRuntimeType;
}
For example, if I had a Foo<String>, my injected type parameter would be a
TypeLiteral<String>. A nice value add, without much complexity.
Original issue reported on code.google.com by limpbizkit on 10 Nov 2008 at 8:33
Original issue reported on code.google.com by
limpbizkit
on 10 Nov 2008 at 8:33