I now understand that Binder.bindScope() is used to bind an annotation such as Singleton.class to a Scope instance such as Scopes.SINGLETON, but it isn't clear to me how one can look up this binding after the fact. That is, when BindingScopingVisitor.visitScopeAnnotation() is invoked, how do I find out what scope is associated with that annotation?
I still haven't figured out the other outstanding questions regarding Injector Binding and visitNoScoping's "linked scope". Gili On Nov 21, 8:07 pm, Gili <[EMAIL PROTECTED]> wrote: > Thanks! More questions... > > What is "Injector binding"? BindingScopingVisitor refers to it but I > tried search for the term and didn't find a definition anywhere. It > might be helpful to define this in the Javadoc brief description on > top. In fact, maybe you should define this > inhttp://code.google.com/p/google-guice/wiki/Scopes > and link to it from the Javadoc on top -- I found this wiki page to be > a very good read! > > Also, visitNoScoping's documentation reads "On a module, this strategy > indicates that the injector should use scoping annotations to find a > scope." Can you please give example of what this means? Also, what > does "An unscoped binding will behave like a scoped one when it is > linked to a scoped binding" mean? It's not clear to me how scopes can > be "linked". > > Finally, there is still a lot of confusion in my mind on the topic of > "scope annotations". visitScopeAnnotation() and Binder.bindScope() > make me believe that you could bind a Scope to an arbitrary annotation > (such as @Red) such that: > > @Red > String username; > > Binder.bind(String.class).annotatedWith(Red.class).to(Foo.class); > Binder.bindScope(Red.class, Singleton.class); > > would mean that username is bound to Foo.class but also has a > Singleton scope. On the other > hand,http://code.google.com/p/google-guice/wiki/Scopes > makes me believe that "scope annotation" refers to Singleton.class -- > that is, an annotation *for* a Scope. Please clarify the Wiki page and/ > or BindingScopingVisitor to explicitly define what a scope annotation > is :) > > Thank you, > Gili > > On Nov 21, 7:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > On Nov 21, 12:04 pm, Gili <[EMAIL PROTECTED]> wrote: > > > > Jesse, > > > > Can you please explain the difference between > > > BindingScopingVisitor.visitEagerSingleton() and visitScope(Scope > > > scope)? I assume there is a reason you didn't just invoke visitScope > > > (Scope.Singleton) instead of exposing a separate method? > > > Eagerness. I've updated the Scopes wiki with a full > > rundown:http://code.google.com/p/google-guice/wiki/Scopes > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
