[picocontainer-dev] circular refs.

Paul Hammant <[email protected]> Fri, 4 Jul 2008 06:47:31 -0700
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Mike went through JIRA updating things (thanks Mike).

One is - http://jira.codehaus.org/browse/PICO-188

It's about circular refs.  It turns out that we always supported  
circular refs unwittingly. If you did Implementation hiding, then the  
circular was possible. Rather than suggest to users that adding  
ImplemementationHiding must be part of the CAF chain for this, I've  
added a characteristic that allows it to specified as you're adding  
the component:

     @Test
     public void circularIsPossible() {
         DefaultPicoContainer pico = new DefaultPicoContainer(new  
Caching().wrap(new SetterInjection()));
          
pico.as(Characteristics.ENABLE_CIRCULAR).addComponent(IFish.class,  
Fish.class);
         pico.addComponent(IWater.class, Water.class);
         IWater water = pico.getComponent(IWater.class);
         IFish fish = pico.getComponent(IFish.class);
         assertNotNull(water.getFish());
         assertNotNull(fish.getWater());
     }
It does not matter which component (in a circular log jam) that you  
specify as ENABLE_CIRCULAR, it amounts to the same thing -  
HiddenImplementation will be in the CA chain for that component.

Thoughts?

Regards,

- Paul

PS - Mike did a typo in the Freshmeat announcement - http://freshmeat.net/projects/picocontainer/?branch_id=43053&release_id=280608 
  - we've now released 2.5 apparently ;-)


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

    http://xircles.codehaus.org/manage_email