Jesse, It isn't clear how to get at Module bindings.
BindingScopingVisitor.visitScopeAnnotation() says "This scope strategy is found only on module bindings", but it isn't clear to me how to fire a BindingScopingVisitor against a Module in the first place. I can see Injector.getBinding(Class) returning a Binding and then a Binding.acceptScopingVisitor() taking BindingScopingVisitor but I don't see the same path for a Module. That is my main source of confusion with respect to "Injector bindings" versus "Module bindings" -- as far as I can tell there is only Injector bindings. Gili On Nov 22, 8:40 pm, Gili Tzabari <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Nov 21, 5:07 pm, Gili <[EMAIL PROTECTED]> wrote: > >> What is "Injector binding"? > > That's defined here: > >http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/googl... > > I assume that Injector.getBinding(Key).acceptScopingVisitor() is the > way to use BindingScopingVisitor on injector bindings, but it isn't > clear how to use it against module bindings. > > I would like to suggest the following: > > - visitEagerSingleton() should link to > ScopedBindingBuilder.asEagerSingleton() > > - visitNoScoping() "An unscoped binding will behave like a scoped one > when it is linked to a scoped binding." should probably reads "[...] > linked to a scoped *target*". I think "target" is easier to understand > in this context (too many uses of the word binding). Alternatively, your > other explanation is also much clearer: "Suppose you bind Foo to > FooImpl. If Foo is unscoped and FooImpl is a singleton, then Foo is > effectively a singleton." > > - visitScopeAnnotation(): It isn't clear when this method is even > invoked. I tried invoking Binder.bindScope() and in(scopedAnnotation) > and neither of these triggered this method. visitScope() was triggered > instead. Remember, I am using the Guice-2.0 snapshot, not trunk. > > > I took another pass on the scopes wiki. Hopefully it makes it more > > obvious what you'll need to do to define a custom scope: > >http://code.google.com/p/google-guice/wiki/Scopes > > Thanks! > > Gili --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
