You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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;
}
}
From mattmccutchen@google.com on October 21, 2011 17:12:58
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;
}
}
Original issue: http://code.google.com/p/google-guice/issues/detail?id=662
The text was updated successfully, but these errors were encountered: