Is there a way to expose a ThrowingProvider from a PrivateModule? (or,
what am I doing wrong?)

If I try this:

public static class FeedModule extends PrivateModule {
  protected void configure() {
    ThrowingProviderBinder.create(binder())
        .bind(FeedProvider.class, BbcFeed.class)
        .to(WorldNewsFeedProvider.class);

    expose(new 
TypeLiteral<FeedProvider<BbcFeed>>(){}).annotatedWith(WorldNews.class);
  }
}

I receive:

1) Could not expose() FeedProvider<BbcFeed> annotated with @WorldNews,
it must be explicitly bound.
  at FeedModule.configure(FeedModule.java:37)

But I can see the key bound in Injector.toString():

ProviderInstanceBinding[key=Key[type=FeedProvider<BbcFeed>,
annotation=[none]],
source=com.google.inject.throwingproviders.ThrowingProviderBinder$SecondaryBinder.to(ThrowingProviderBinder.java:110),
scope=Scopes.NO_SCOPE,
provider=com.google.inject.throwingproviders.ThrowingProviderBinder$SecondaryBinder$1@d18d189]

I also tried using TypeLiteral.get(...), and I get the same error.

Thanks!

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

Reply via email to