Re: The never-ending beta of Guice 4

2015-03-16 Thread James Roper
I don't always +1 things, but when I do, I +1 a stable release of Guice 4. On Sunday, 15 March 2015 03:10:35 UTC+11, Sam Berlin wrote: ... Actually I guess today isn't really St Patrick's day... parades throw you off. But we still hear y'all. sam -- Forwarded message

Re: Best way to implement factory with Guice

2015-03-16 Thread Laszlo Ferenczi
Hi, There are many ways to solve this problem, one easy enough to understand: @Inject ProviderCrawlerOne crawlerOneProvider; @Inject ProviderCrawlerTwo crawlerTwo; public Crawler getCrawler(String url) { if (url...) { return crawlerOneProvider.get(); } else {

Re: Best way to implement factory with Guice

2015-03-16 Thread Barak Yaish
Thanks. Is there a way to overcome the exhausting if-else if- else if structure, some magical way to support new crawlers in the system without register them in that factory? On Monday, March 16, 2015 at 3:57:56 PM UTC+2, Laszlo Ferenczi wrote: Hi, There are many ways to solve this problem,

Re: Best way to implement factory with Guice

2015-03-16 Thread Sam Berlin
Take a look at MapBinder or Multibinder: https://github.com/google/guice/wiki/Multibindings sam On Mon, Mar 16, 2015 at 11:42 AM Barak Yaish barak.ya...@gmail.com wrote: Thanks. Is there a way to overcome the exhausting if-else if- else if structure, some magical way to support new crawlers

Re: Best way to implement factory with Guice

2015-03-16 Thread Stephan Classen
Don't inject the injector. Its almost always a code smell. Am 16. März 2015 14:57:13 MEZ, schrieb Laszlo Ferenczi lferen...@gmail.com: Hi, There are many ways to solve this problem, one easy enough to understand: @Inject ProviderCrawlerOne crawlerOneProvider; @Inject ProviderCrawlerTwo