Does this new SPI let me do this? http://groups.google.com/group/google-guice/browse_thread/thread/8d0a950cf9cd2da8/fc60b5631a15db41
On Sep 6, 10:09 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > The new Guice 2 SPI is ready for your feedback. > The Service Provider Interface exposes Guice > internal models to aid in the development in > tools, extensions, and plugins. > > Development Story... > > This package was built by unifying two > independently developed APIs: Guice Commands > and the injector SPI. > > Guice Commands was written to introspect, > rewrite, and validate modules. If you consider a > module to be your injector's source code, then > commands is kind of like static analysis and > code-rewriting -- stuff you do with a compiler > and AST. > http://publicobject.com/2008/02/guice-commands.html > > The Injector API was written to inspect > the bindings of an already-built injector. It > gave access to the bindings, and their > dependency graph. If you consider a module > to be your injector's source code, then the > injector API is kind of like reflection -- stuff > you do at runtime. > > Motivation... > > The new SPI works with the elements of > both Modules and Injectors. It's intended > to give it's users full access to everything > they might need to know. And for the > Modules SPI, it also gives you the ability > to compose new modules from old ones. > > At the same time, I want something that's > fairly small and easy enough to code > against. This code snippet logs a warning > for each static injection in your Modules: > > public void warnOfStaticInjections(Module... modules) { > for (Element element : Elements.getElements(modules)) { > element.acceptVisitor(new DefaultElementVisitor<Void>() { > @Override > public Void visitStaticInjectionRequest(StaticInjectionRequest > element) { > logger.warning("Static injection is fragile! Please fix " > + element.getType().getName() + " at " + > element.getSource()); > return null; > } > }); > } > } > > The SPI leans a lot on the visitor pattern, > which I admit is not for everyone. > > Please comment... > > Grab the latest Guice snapshot from SVN > and take the new SPI for a spin. I wanna > make sure there's no problems in it before > the 2.0 release. > svn checkouthttp://google-guice.googlecode.com/svn/trunk/google- > guice-read-only > > Alternately, running through the Javadocs > might give you a feel for the package: > http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/googl... > Note that the Javadoc still needs some > love -- but if there's ideas or suggestions > you have for the docs that's welcome as > well. > > Thanks, > Jesse --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
