Just bind a TypeLiteral<Set<OtherClass>> to the empty set. Or use Multibinder.newSetBinder without binding anything.
Dhanji. On Tue, Feb 3, 2009 at 7:43 PM, Martin Lukasiewycz <[email protected]> wrote: > > Hi everybody, > I have a question regarding the Guice 2 Multibinder feature. > > I want a class to inject a set of other classes: > > public class SomeClass { > @Inject > public SomeClass(Set<OtherClass> set){ > > } > } > > Now, if I never use a Multibinder.newSetBinder(binder > (),SomeClass.class), Guice will throw an exception saying that the set > of OtherClass is not bound. In fact, i expected and would like Guice > to inject an empty set. Is there any simple way to change this > behaviour of the injector? > > thanks in advance > Martin > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" 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?hl=en -~----------~----~----~----~------~----~------~--~---
