quantummaid / injectmaid

Lightweight dependency injection framework that does not rely on annotations.
https://quantummaid.de
Apache License 2.0
9 stars 0 forks source link

[ISSUE] Need to be able to do a generic getInstance like Guice w/TypeLiteral (without having to cast) #37

Closed lestephane closed 3 years ago

lestephane commented 4 years ago

(the project description says that generics are fully supported, but I can't find much documentation about how to use them, so this issue comes from exploratory testing)

Guice can do this:

    Cursor<User> instance = 
        injector.getInstance(Key.get(new TypeLiteral<Cursor<User>>() {}))

I cannot do this with InjectMaid, or at least I didn't manage. I'm having to do a cast

image