Comment #9 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
IMHO anything that could be achieved without changing the core should really belong in an extension or utility library.
Fair enough.
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.
Yes, that's what I ended up writing (for the Google-internal code that may later be converted to MapBinder so it doesn't need Injector#getInstance). Is there a catch-all utility extension where such a method could be placed, or do you prefer to force every client to duplicate it as a way of harassing them for using Injector#getInstance? :P
I would then like to patch the Injector#getInstance javadoc to either refer to the extension method or, if the extension method is not to be, describe the technique right there.
-- 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.
