Comment #3 on issue 369 by [email protected]: Convenient way to expose multibindings and mapbindings from PrivateModules
http://code.google.com/p/google-guice/issues/detail?id=369

Would this be possible if the MapBinder had an 'outer' binder and private binder available?

It's not ideal, but I could see doing something like

install(new MyMapBinderModule(binder());

in an abstract module and the MyMapBinderModule/MapBinder could look something like

public class MyMapBinderModule extends PrivateModule
{
    private final Binder m_publicBinder;

    public MyMapBinderModule(Binder publicBinder)
    {
        m_publicBinder = publicBinder;
    }

    @Override
    protected void configure()
    {
        MapBinder<String, MessageHandler> mapBinder =
MapBinder.newMapBinder(m_publicBinder, binder(), Foo.class, Bar.class);
    }
{


Alternately, if we could somehow just do

expose(mapBinder) or mapBinder.expose() or something that would be awesome.

I don't know if this is too 'hacky', but it's leagues above the hacks I have in place to do this right now.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" 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-dev?hl=en.

Reply via email to