[picocontainer-dev] Pico2: AdaptiveBehaviorFactory - new class.

Paul Hammant <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Erik mentions that DPC's default of Caching & CDI is not necessarily  
the best situation. And that the ctors for DPC that don't contain a  
ComponentFactory (formerly CAF) should perhaps be deleted.

Is AdaptiveBehaviorFactory a better default though ?

If used, it would mean that Caching is no longer default behavior for  
DPC and that Field-Annotation, Method-Annotation as well as CDI would  
be casually supported.

It will still be possible to specify chains of ComponentFactories as  
it has been in the past, this is a new one, not one that replaces  
others.

AdaptiveBehaviorFactory can recognize Caching, Implementation Hiding  
and Syncronized (thread safe) behavior via characteristics:

    MPC mpc = new DPC();
    mpc.as(CACHE, HIDE, THREAD_SAFE).addComponent(Map.class,  
HashMap.class);

    mpc.as(SINGLE).addComponent(Map.class, HashMap.class);  //  
alternative to CACHE for just single-instance (or what Guice calls  
singleton)

Characteristics of course are optional.  I've upgraded DPC to barf is  
a characterization is set, but not processed during addComponent 
(..).  Meaning its fail-fast for errors in setup.

Thoughts?

- Paul

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email
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.