The Guice philosophy is that the order of bindings in modules doesn't 
matter, so hasBinding() doesn't really make any sense until after the 
Injector is created.

One thing you could do is make a module full of default bindings and tell 
clients to use Modules.override(new DefaultsModule()).with(new 
TheirModule()).

On Friday, 7 February 2014 09:07:52 UTC-5, Jochen Wiedmann wrote:
>
>
> Hi,
>
> I'd like to create a reusable module, which provides some default 
> bindings. In order to do so, I'd like to have code like this:
>
>
>     public void configure(Binder pBinder) {
>         if (!hasBinding(pBinder, java.util.List.class)) {
>             
> pBinder.bind(java.util.List.class).to(java.util.ArrayList.class);
>         }
>     }
>
> The problem is: How would I implement the method hasBinding(Binder, 
> Class<?>)?
> Or, do you have another suggestion to get my idea working?
>
> Thanks,
>
> Jochen
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to