getting all types with a binding annotation

48 views
Skip to first unread message

Daniel Murphy

unread,
May 9, 2012, 10:25:47 PM5/9/12
to google...@googlegroups.com
Is it possible to get the set of all types with a given binding annotation?  I would need to access this set from an injector.  My first thought is to load them into a multiset with a type listener, but it doesn't look like I can do any bindings from a type listener.  Can I somehow make multiset bindings from a visitor?  Can I add visitors from inside a module to the whole dependency hierarchy?

Thanks,
Daniel

Alen Vrečko

unread,
May 10, 2012, 12:31:19 PM5/10/12
to google-guice
Why don't you use injector#getAllBindings()? What is the use case?

Cheers
Alen

Daniel Murphy

unread,
May 10, 2012, 2:27:28 PM5/10/12
to google...@googlegroups.com
That would probably work.  I'm using this in a custom module (very similar to the RealMultibinder module), and I'll be requesting these objects when my @Inject @Toolable initialize(Injector) method is called.  I'm assuming the getDependencies() -> Injector followed by getDependencies() -> read dependencies pattern works for any provider with HasDependencies?

Thanks,
Daniel
Reply all
Reply to author
Forward
0 new messages