Re: [picocontainer-dev] Decorator with 2.x ?

GrĂ©gory Joseph <[email protected]> Fri, 28 Jan 2011 09:14:24 +0100
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Hey,

On 27 January 2011 21:00, Paul Hammant <[email protected]> wrote:
> One has to subclass Decorating and implement a Decorator I think.

Yeah, after I sent the email and went out for a few minutes, I
realized I could do this:
                final Decorating decorating =3D new Decorating() {
                    public void decorate(Object instance) {
                        System.out.println("HELLO " + instance);
                    }
                };
                pico.addAdapter(
                    decorating.createComponentAdapter(new
NullComponentMonitor(), new NullLifecycleStrategy(), new Properties(),
moduleClass, moduleClass, null)
                );

... as you might guess, I'm not too happy about the CM and LCS bits,
I'd like to "get them" from my current pico.

> You could easily bake conditional logic into your=A0Decorating subclass t=
hat
> would do what you want - right ?

Not really (although I haven't given it much thought), the components
I'm decorating have no specific interface or annotation to
differentiate them, they're just registered from a different source...


> See that I did some work on the site -=A0http://picocontainer.github.com/=
 ?

Ha cool, no more 404 images ;) Had been a while since I seen it. HA!
and I see the navigation changed. I'm still kind of missing a high
level navigation, either on the side or the top, though.

> Its almost ready to flip the switch. =A0This weekend perhaps I'll merge f=
rom
> 2.x to 3.x where needed and address the outstanding questions.

Excellent, thanks !

-g


> - Paul
>
> 2011/1/27 Gr=E9gory Joseph <[email protected]>
>>
>> Hi list,
>>
>> Is there any way to use Decorated with 2.x without using Decorating ?
>> Point is, I want to use a certain adapter and a certain Decorator on
>> only a limited set of components I'm registering, and it seems like
>> creating my container with the Decorating factory will have all my
>> components decorated.
>>
>> If org.picocontainer.behaviors.Decorated.Decorator was public, I guess
>> I could do what I want here, but maybe I'm look at it the wrong way,
>> and there's another method I could use ?
>>
>> I'm essentially trying to decorate components, bean-style, based on an
>> existing mechanism (which loads those values of a JCR repository, if
>> you must know) - so while I know where those values come from at
>> registration time, I have no idea what they (add to that the fact that
>> I need to proxy those objects because said values can change over
>> time;))
>>
>> Thanks for any hint,
>>
>> -g
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> =A0 =A0http://xircles.codehaus.org/manage_email
>>
>>
>
>

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

    http://xircles.codehaus.org/manage_email