Interesting, I suspected that a more IoC approach would be called for... guicey indeed.
Thanks On Wed, Dec 3, 2008 at 5:03 PM, Dhanji R. Prasanna <[EMAIL PROTECTED]> wrote: > > Without knowing what exactly you're trying to do with this list, this > might be a "Guicey" place to start: > http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/google/inject/multibindings/Multibinder.html > > Basically, multibinder allows you to contribute bindings (of the same > type) from various modules and collect them in a single list. This is > sorta the reverse of the Spring approach of scanning the bean-factory > for beans that implement a type. In other words: > > -beanfactory scan => service locator pattern > -multibinder => dependency injection (ioc) pattern > > You can then simply @Inject the "multibound" list and use it anywhere. > > Dhanji. > > On Thu, Dec 4, 2008 at 9:58 AM, Jon Gorrono <[EMAIL PROTECTED]> wrote: >> >> Greetings, first email to the list.... it always starts with the >> whining :) ... so here goes.... >> >> >> I'm pretty new to guice and so need a little help with this one.... >> >> We are trying to port an existing Spring app that uses marker >> interfaces to identify all the defined (and instantiated) implementers >> of a particular maker interface. >> >> In Spring this looks like >> >> private List<Object> getAutoRegisteredBeansOfType(Class<?> c) { >> String[] autobeans = applicationContext.getBeanNamesForType(c, >> false, false); >> List<Object> l = new ArrayList<Object>(); >> for (String autobean : autobeans) { >> if (autoRegistered.contains(autobean)) { >> Object bean = applicationContext.getBean(autobean); >> l.add(bean); >> } >> } >> Collections.sort(l, new OrderComparator()); >> return l; >> } >> >> ... I suspect the answer to this will involve looking at the problem >> from a guicey angle.... so that is what I am hoping to get some help >> with... putting me on the right path maybe... >> >> Thanks for taking a look. >> >> >> -- >> Jon Gorrono >> email{>+++++++++[>+++++++++++>++++++++++++>+++++++>+++++<<<<-]>+++++++.>++++.<---.>-.+++..---.-.+.>+.<++++++.<----.+.---.>+.<++++++++.>---.>>+.<<<----.-.>++.} >> http{ats.ucdavis.edu} >> >> > >> > > > > -- Jon Gorrono email{>+++++++++[>+++++++++++>++++++++++++>+++++++>+++++<<<<-]>+++++++.>++++.<---.>-.+++..---.-.+.>+.<++++++.<----.+.---.>+.<++++++++.>---.>>+.<<<----.-.>++.} http{ats.ucdavis.edu} --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
