Re: [picocontainer-dev] comments on injection
Paul Hammant <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Erik, You left off new classes :-) Most particularly - DynamicRegistrationLocator.java - Paul On May 31, 2007, at 4:09 PM, Putrycz, Erik wrote: > Ok here we go! > > The locator interface can allow to easily implement things like > @ImplementedBy (no need to panic, it’s not in the patch) and also > dynamic registration (a component not found is directly added to > the container). I find this very handy. This doesn’t affect pico’s > behavior by default. > > > MutablePicoContainer pico = new > DefaultPicoContainer(); > > pico.addLocator(new > DynamicRegistrationLocator()); > > LinkedList<String> list = pico.getComponent > (LinkedList.class); > > assertNotNull(list); > > > I have in my code also a @NonInstantiable annotation so that pico > can throw an exception if it tries to create one of these annotated > classes. > > Another small change, I updated junit to 4 so that you can use the > annotations. > > > Erik Putrycz, Ph.D - Research Associate / erik.putrycz@nrc- > cnrc.gc.ca / (613) 990 0681 > > Institute for Information Technology - Software Engineering Group > > National Research Council, Canada - Building M-50, 1200 Montreal Road > > Ottawa, Ontario, CANADA K1A 0R6 > > From: Paul Hammant [mailto:[email protected]] > Sent: May 31, 2007 16:24 > To: dev-qxt/[email protected] > Subject: Re: [picocontainer-dev] comments on injection > > > Give us patches dude, for both member injection and hooks - you > mean @implementedBy(...) right ? > > > -ph > > > ps - be aware there are renames going on presently. > > > For one, I'm killing org.picocontainer.defaults.* class by class. > Either moving them to elsewhere or deleting them as they've proven > after four years to not be need at the current level of type-safety > (exceptions) > > > > On May 31, 2007, at 11:48 AM, Putrycz, Erik wrote: > > > > > I moved most of my project to pico 2 and was hoping to use the new > injection but currently the only injection available is on methods… > > I’m not very keen on the method injection, it creates IMO often too > much verbose code whereas a member injection is quicker to write. > Often I don’t even need a getter and setter… > > However I think both would be nice to have. > > Any objection on adding member injection? > > I also think I figured out a way to inject members of an existing > object without modifying the container. I’ll see how that turns out. > > > Last comment… I know this is very unpopular here but I’d be nice if > there was some kind of hook in Pico to be able to setup auto > registration of classes. Somekind of callback on getComponent – > when not found – would be nice. > > > <Pico2-locator.patch> > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email