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

Erik Putrycz <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Organization National Research Council Canada
Message-ID <[email protected]>

Paul Hammant wrote:
>         MutablePicoContainer mpc = new 
> PicoBuilder().withCaching().withHiddenImplementations().withSetterInjection().build(); 
> // this one is working now
>         MutablePicoContainer mpc = new 
> PicoBuilder().cachedInstances().hideImplementations().forSetterInjection().build(); 
>         MutablePicoContainer mpc = new 
> PicoBuilder().caching().hidden().forSDI().build(); 
>         MutablePicoContainer mpc = new 
> PicoBuilder().allSingletons().hidden().forSDI().build(); 
>
>         MutablePicoContainer mpc = new 
> PicoBuilder().cachedInstances().hideImplementations().build(); // will 
> do CDI implicitly & also working now
>
> At the moment, the order is important.  I'm sure that could be fixed 
> though.
The problem of this builder is that it won't be extensible for other 
pico modules. Otherwise, I think it is a step in the right direction.
And something could be done for the order. Lets say you use the 
ComponentCharacteristic for the builder:
MutablePicoContainer mpc = new PicoBuilder().with(SDI).with(Cached).build();
Where SDI and Cached are ComponentCharacteristic.
Each component characteristic could implement something like
 Class<? extends CompenentAdapterFactory> before();
 Class<? extends CompenentAdapterFactory> after();
This way the builder makes a list of CAFs classes and can order them to 
some extend.

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