2008/10/17 [EMAIL PROTECTED] <[EMAIL PROTECTED]> > > Child injectors (aka. chained injectors, hierarchical injectors) > enable injectors that inherit state from another injector. This is > useful for splitting up the aspects of an application -- perhaps into > a user interface injector and a persistence injector. Or to maintain > separate instances of a subapplication, such as the individual > workspaces of an IDE. Child injectors are intended for frameworks and > extensions, so most users won't encounter them directly. > > I've recently rewritten Guice's implementation from scratch. The new > implementation is tighter. For example, it prevents bindings from > overlapping in parent and child. If you're using the current > implementation from SVN, please try out the new code. Any > incompatibilities should show up in the form of errors when you create > your injector. The API has also moved from a static method on the > Guice class to an instance method on Injector. >
good stuff - the instance method makes much more sense and I like how JIT bindings will percolate up the hierarchy Here's the new method's Javadoc (from Injector.java): > > /** > * Returns a new injector that inherits all state from this > injector. All > * bindings, scopes, interceptors and type converters are inherited > -- they > * are visible to the child injector. Elements of the child injector > are not > * visible to its parent. > * > * <p>Just-in-time bindings created for child injectors will be > created in an > * ancestor injector whenever possible. This allows for scoped > instances to be > * shared between injectors. Use explicit bindings to prevent > bindings from > * being shared with the parent injector. > * > * <p>No key may be bound by both an injector and one of its > ancestors. This > * includes just-in-time bindings. The lone exception is the key for > [EMAIL PROTECTED] > * Injector.class}, which is bound by each injector to itself. > */ > Injector createChildInjector(Iterable<? extends Module> modules); > > You can find this update in Guice SVN. > > Cheers, > Jesse > > -- Cheers, Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
