Comment #7 on issue 658 by [email protected]: Make it clear how to do an optional Injector.getInstance
http://code.google.com/p/google-guice/issues/detail?id=658
+1 for expanding the javadoc, -1 for adding additional variants of the getInstance method
IMHO anything that could be achieved without changing the core should really belong in an extension or utility library. In this case checking the binding exists before calling its provider (and returning null or a default value if it doesn't exist) could easily be performed by a simple static utility method.
I also think getInstance should be used as sparingly as possible, since you're adding a direct dependency to the Guice API rather than rely on the standard annotations (which provide looser coupling). Ideally the only places you should need to call getInstance are when bootstrapping the application or when calling into the injected graph from an external context.
Most of the issues I've dealt with recently wrt. application portability have been down to uses of getInstance.
-- You received this message because you are subscribed to the Google Groups "google-guice-dev" 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-dev?hl=en.
