-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
It looks like this is a known limitation and I was looking for an outstanding issue to see if work was being done to try and address it. I'd like to be able to do the following:
public final class MyAppModule extends AbstractModule {
@Override
protected void configure() {
install(new FooPrivateModule());
install(new BarPrivateModule());
}
}
public final class FooPrivateModule extends PrivateModule {
@Override
protected void configure() {
Multibinder<Thing> thingBinder = Multibinder.newSetBinder(binder(), Thing.class);
thingBinder.addBinding().to(FooThing.class);
expose(new TypeLiteral<Set<Thing>>() {});
}
}
public final class BarPrivateModule extends PrivateModule {
@Override
protected void configure() {
Multibinder<Thing> thingBinder = Multibinder.newSetBinder(binder(), Thing.class);
thingBinder.addBinding().to(BarThing.class);
expose(new TypeLiteral<Set<Thing>>() {});
}
}
Set<Thing> things = Guice.createInjector(new MyAppModule()).getInstance(Key.get(new TypeLiteral<Set<Thing>>() {}));
// things would contain FooThing bound and exposed in FooPrivateModule and BarThing bound and exposed in BarPrivateModuleThanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels