|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
circular refs.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 |
|
|
RE: circular refs.Hi Paul,
Paul Hammant wrote: > 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? IMHO a good idea to enable this as feature for a single component instead of using internally proxies for all components (which was in fact the reason why we did not use it by default in Pico 1.0 IIRC). - Jörg --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: circular refs.On Jul 4, 2008, at 6:47 AM, Paul Hammant wrote:
> 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); why its being used -pete -- (peter.royal|osi)@pobox.com - http://fotap.org/~osi |
|
|
Re: circular refs.peter royal wrote:
> On Jul 4, 2008, at 6:47 AM, Paul Hammant wrote: >> 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); > > +1 .. the IH workaround is kinda sneaky, its good to be explicit on why > its being used +1 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free Forum Powered by Nabble | Forum Help |