-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multibindings usage? #48
Comments
Unlike in Guice, with Fruit you can't inject the multibindings as a
dependency of another object (e.g. using constructor injection).
As in the example, you need to get the multibindings directly from the
injector. It's up to you then how you pass those to the relevant objects.
You could pass them as method arguments to an injected object, or if you
have only one injector you could store them in a static variable.
There are probably other reasonable ways too, if neither of the above works
well for you please explain your use case and I can try suggesting some
alternatives.
…On 25 Apr 2017 11:42 am, "NiKu" ***@***.***> wrote:
Hi,
I'm a bit confused on how to actually use multibindings.
In the quick reference
<https://github.com/google/fruit/wiki/quick-reference> you access the
multibindings via the injector object. But how would you that list of
listeners injected into some other class. Do I need to make the injector
object globally accessible to do access the list of bound objects?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#48>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABeeF5PAyDAC1nhO-YShxoYKJ1VSYHbJks5rzc4OgaJpZM4NHTSR>
.
|
thanks. I have to think that through a little bit more. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I'm a bit confused on how to actually use multibindings.
In the example in the quick reference you access the multibindings via the
injector
object. But how would you inject that list of listeners into some other class. Do I need to make theinjector
object globally accessible to do access the list of bound objects from within the class itself?The text was updated successfully, but these errors were encountered: