Re: [picocontainer-dev] Pico2: AdaptiveBehaviorFactory - new class.
Paul Hammant <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
The more I think about this, the more I like it. I'll flip it over
after work today if there's no other discussion.
- Paul
On Jun 18, 2007, at 6:21 AM, Paul Hammant wrote:
> 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
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email