Status: New
Owner: ----

New issue 662 by [email protected]: Multibinder should accept bindings to sets of elements
http://code.google.com/p/google-guice/issues/detail?id=662

Multibinder should accept bindings to sets whose size is not known until injector creation and then add all the elements of the sets to the multibound set. Contrived example:

Multibinder.newSetBinder(binder(), User.class, MyAnnotation.class)
  .addSetBinding().toProvider(HappyEngineersProvider.class);

class HappyEngineersProvider implements Provider<Set<User>> {
  @Inject Company company;

  @Override public Set<User> get() {
    Set<User> happyEngineers = new HashSet<User>();
    for (User e : company.getEngineers())
      if (e.isHappy())
        happyEngineers.add(e);
    return happyEngineers;
  }
}


--
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.

Reply via email to