> This is commonly called the 'robot legs' problem and it's something
> we've historically been fairly bad at. But the recently-announced
> PrivateModules extension can do the trick:
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.
configure() {
bind( Foo.class ).to( FooImpl.class );
bind( A.class ).to( Eh.class )
.with( B.class ).to( Beer.class ) //keep Beer private
}
is the same as
configure() {
bind( Foo.class ).to( FooImpl.class );
install( new PrivateModule() {
protected void configurePrivateBindings() {
bind( A.class ).to( Eh.class );
bind( B.class ).to( Beer.class );
expose( A.class );
}
}
}
The use of 'with' is a little arbitrary, I"m not sure if I like it or
not, but really this is a proof of concept and doesn't support the
full EDSL anyway. This is in no way a replacement for PrivateModules;
it's just syntactic sugar for one simple use case.
I'd appreciate other's opinion on this idea.
http://www.hullabaloo.ca/darren/code/XAbstractModule.java.txt
http://www.hullabaloo.ca/darren/code/XAbstractModuleTest.java.txt
So, what do you think?
-d
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---