Mike Simpson
2008-05-16 03:54:25 UTC
Hi --
I poked around in the 2.2 source, and this:
http://picocontainer.codehaus.org/javadoc/core/src-html/org/picocontainer/behaviors/HiddenImplementation.html#line.83
seems to be the important method. On line 84, it does look like a new
-mgs
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
MutablePicoContainer mpc = new PicoBuilder().withConstructorInjection()
.withHiddenImplementations()
.withConsoleMonitor()
.build();
mpc.addComponent( picotest.model.Thing.class,
picotest.model.impl.DefaultThing.class );
Thing t = (Thing) mpc.getComponent( picotest.model.Thing.class );
t.setStuff( "foo" );
System.out.println( "this thing's stuff = " + t.getStuff() );
this thing's stuff = null
From the ConsoleMonitor output, it looks like a new instance of.withHiddenImplementations()
.withConsoleMonitor()
.build();
mpc.addComponent( picotest.model.Thing.class,
picotest.model.impl.DefaultThing.class );
Thing t = (Thing) mpc.getComponent( picotest.model.Thing.class );
t.setStuff( "foo" );
System.out.println( "this thing's stuff = " + t.getStuff() );
this thing's stuff = null
t.poke();
t.poke();
t.poke();
PicoContainer: instantiating picotest.model.impl.DefaultThing()
PicoContainer: instantiated picotest.model.impl.DefaultThing() [0 ms], component picotest.model.impl.DefaultThing, injected []
PicoContainer: instantiating picotest.model.impl.DefaultThing()
PicoContainer: instantiated picotest.model.impl.DefaultThing() [0 ms], component picotest.model.impl.DefaultThing, injected []
PicoContainer: instantiating picotest.model.impl.DefaultThing()
PicoContainer: instantiated picotest.model.impl.DefaultThing() [0 ms], component picotest.model.impl.DefaultThing, injected []
Is this the intended behavior? It doesn't seem right, to me at least. :)t.poke();
t.poke();
PicoContainer: instantiating picotest.model.impl.DefaultThing()
PicoContainer: instantiated picotest.model.impl.DefaultThing() [0 ms], component picotest.model.impl.DefaultThing, injected []
PicoContainer: instantiating picotest.model.impl.DefaultThing()
PicoContainer: instantiated picotest.model.impl.DefaultThing() [0 ms], component picotest.model.impl.DefaultThing, injected []
PicoContainer: instantiating picotest.model.impl.DefaultThing()
PicoContainer: instantiated picotest.model.impl.DefaultThing() [0 ms], component picotest.model.impl.DefaultThing, injected []
I poked around in the 2.2 source, and this:
http://picocontainer.codehaus.org/javadoc/core/src-html/org/picocontainer/behaviors/HiddenImplementation.html#line.83
seems to be the important method. On line 84, it does look like a new
Object componentInstance = getDelegate().getComponentInstance(container);
Apologies in advance if I'm missing something obvious. :)-mgs
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email