Re: [picocontainer-dev] comments on injection

Paul Hammant <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
What other usecase is there Erik ?

For the one you;ve given :-

+	@Test
+	public void testDynamicRegistration() {
+		MutablePicoContainer pico = new DefaultPicoContainer();
+		ComponentLocator dynamicReg = new DynamicRegistrationLocator();
+		pico.addLocator(dynamicReg);
+		LinkedList<String> list = pico.getComponent(LinkedList.class);
+		assertNotNull(list);
+	}


I might prefer ..

+	@Test
+	public void testDynamicRegistration() {
+		MutablePicoContainer pico = new DefaultPicoContainer();
+		LinkedList<String> list = pico.addComponent 
(LinkedList.class).getInstance();  // getInstance() is new and  
implicitly on the last component added ~  v easy to implement
+		assertNotNull(list);
+	}

I know you have a 'bigger' use of your way up your sleeve :-)

- Paul

On Jun 1, 2007, at 9:46 AM, Putrycz, Erik wrote:

> <Pico2-locator.patch>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.