On Oct 30, 3:35 am, dg <[EMAIL PROTECTED]> wrote:
> OK, Private modules are pretty frickin' cool.  I found the syntax a
> bit unwieldy for what I was trying to do so I wrote a wrapper to allow
> private modules to participate, to some extent, in the Guice Binding
> EDSL.

This is cool. I'm considering a similar syntax:
  public class HidingModule implements Module {
    public void configure(Binder binder) {
      PrivateBinder privateBinder = binder.newPrivateBinder();
      privateBinder.bind(A.class).to(Eh.class);
      privateBinder.bind(B.class).to(Beer.class);
      privateBinder.expose(A.class);
    }
  }

The API changes involve a new method on Binder:
  public interface Binder {
    PrivateBinder newPrivateBinder();
  }

And a new PrivateBinder interface:
  public interface PrivateBinder extends Binder {
    AnnotatedExposeBuilder expose(Class<?> type);
    AnnotatedExposeBuilder expose(TypeLiteral<?> type);
    void expose(Key<?> key);
  }

The biggest advantage of this approach is that it would allow private
modules to participate in the Guice SPI. Currently the private
bindings will not show up when you call Elements.getElements(Module)
for example.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to