[picocontainer-dev] Providers
Paul Hammant <[email protected]> Wed, 22 Oct 2008 07:54:56 -0700
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Folks,
My Guice buddies are divided on whether their providers feature is
mainstream or niche. It allows you to have a factory that can help
make deps on a just in time basis (for the particular scope) for other
components to use.
The interface goes like so :
interface Provider<T> {\
T get();
}
For Pico, as of a commit yesterday, we have a provider too. It's a
little different. It's less generic than the Guice one :
interface Provider {
}
It's a convention idiom. Have one method provide that returns the type
you're interested in providing, but have as many concrete arguments
for that method as you require. As long as those deps can be satisfied
by the PicoContainer instance that is managing it, then it'll be fine.
Have a look at Chocolatier and Chocolatier2 in http://svn.codehaus.org/picocontainer/java/2.x/trunk/pico/container/src/test/org/picocontainer/injectors/ProviderTestCase.java
(yes there are two ways of working with Providers).
Thoughts?
Regards,
- Paul
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email