There's no built-in way to remove a binding, but you can use the Elements SPI to do it if you'd like. Use Elements.getElements(Modules), visit the elements to find the binding you'd like to remove (and create a list of Elements without that binding), and call Elements.getModule(Elements) to make a Module out of your resulting list of Elements.
You shouldn't really be doing this in production code, though. It sounds more like a test-specific thing. Sam On Mon, May 17, 2010 at 4:16 AM, Jimmy Yuen Ho Wong <[email protected]>wrote: > I was just wondering when I'm overriding ModA with ModB, can I do > something like unbind(SomeClassBoundInModA.class) in ModB's > configure() implementation? Is there's anything in Guice 2.0 that can > accomplish this effect? The reason I'm asking for this is that I know > Modules.override() has an undocumented feature of merging 2 or more > modules, but I'm not sure if I can override a binding by deletion. > > Thanks in advance! > > -- > 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]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > > -- 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.
