Open GoogleCodeExporter opened 9 years ago
Is there a reason
Dependency.forInjectionPoints(InjectionPoint.forInstanceMethodsAndFields(obj.get
Class())) itself can't do the trick?
Original comment by sberlin
on 11 Oct 2011 at 12:44
No, but neither is there a reason that writing one's own dependency injection
framework can't do the trick, and yet you provide Guice. Libraries are
supposed to make things easy for their callers.
It took me some time to convince myself that that chain of calls was the proper
way to establish dependencies on an object being injected and there wasn't
another better way that I was missing. Guice should provide a single method so
programmers don't duplicate that mental work.
Original comment by mattmccu...@google.com
on 11 Oct 2011 at 3:32
I think we can agree that writing a DI framework like Guice is a little more
complex than chaining two method calls together. Guice isn't attempting to
provide utility methods for every possible usecase, it's just providing the
means for users to get what they need and expose the common scenarios. A small
API makes it easier for people to understand.
If it turns out that writing
Dependency.forInjectionPoints(InjectionPoint.forInstanceMethodsAndFields(..))
is an incredibly common use case, it's easy to make an API.
Original comment by sberlin
on 16 Oct 2011 at 3:50
Original issue reported on code.google.com by
mattmccu...@google.com
on 11 Oct 2011 at 5:36