Re: [picocontainer-dev] annotations and comments on Pico2

Paul Hammant <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
>
>    pico.addComponent(Foo.class, FooImpl.class).with(HIDING);
>    pico.addComponent(Bar.class, BarImpl.class).as(SINGLETON);


OK, so added support for that. Go to:

     http://svn.codehaus.org/picocontainer/java/sandbox/baby-steps/ 
pico2/container/src/test/org/picocontainer/defaults/ 
DefaultPicoContainerTestCase.java

And search for "Horse" in page.

You'll see three tests that show a persistent change of the  
container's characteristic, and two tests that show a transient  
modification to the container's characteristics.

The last two are the new ones. Its a little different to what I  
outlined earlier:

         MutablePicoContainer container = new DefaultPicoContainer();
         container.as(SDI).addComponent(SdiComponent.class);
         container.as(SDI).addComponent(AnotherSdiComponent.class);
         container.addComponent(CdiComponent.class);

SDI is used in the test as it deviates from the Pico norm of CDI.   
Refer the workings of AnyInjectionComponentAdapterFactory.

----

Peter and I debated 'with' and 'as' in the pub as method names.  The  
two could end up synonymous, or we could standardize of phrasing:

as -

   SINGLETON
   HIDDEN
   SWAPPABLE

with -

   SINGLETON
   HIDDEN_IMPLEMENTATION
   SWAPPABLE_IMPLEMENTATION

Thoughts?

- Paul
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.