[picocontainer-dev] characteristics, properties, and per component decoration

Mike Rettig <[email protected]> Mon, 30 Aug 2010 22:41:57 -0500
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Paul,

Did you have any thoughts on my post? I know you do.

Thanks,

Mike

---------- Forwarded message ----------
From: Mike Rettig <[email protected]>
Date: Sat, Aug 14, 2010 at 3:01 PM
Subject: characteristics, properties, and per component decoration
To: dev-qxt/[email protected]


I'm working on a port of spruice (http://www.spruice.org) to pico.
Spruice is a programmatic api to wire components using type safe
proxies. It currently uses spring for programmatic object wiring. I'd
like to remove spring due to its heavyweight nature.

I'm having some difficulties porting to pico due to the per component
customizations. I need to pass unique wiring constraints for each and
every component. In the pico docs, I can see how this can be done
using the Characteristics class and Properties. Is this really the
best way to do this? Is there some other way to do per component
customizations and not use Properties?

e.g.
container.as(MY_PROPERTIES);

I'd prefer a simple decorator chaining api.

PicoDecorator<MyClass> myDecorator =3D new PicoDecorator<MyClass>(){
=A0 =A0SomeObject dataForThisComponent;
=A0 =A0public MyClass decorate(MyClass instance) {
=A0 =A0.... modify object
=A0 =A0 return instance;
=A0 }
};

Properties props =3D ...bean properties

MutablePicoContainer container =3D ...
container.createAdapterChain()
=A0 =A0 =A0 =A0 =A0 =A0 .cache()
=A0 =A0 =A0 =A0 =A0 =A0 .decorate(myDecorator)
=A0 =A0 =A0 =A0 =A0 =A0 .setBeanProperties(props)
=A0 =A0 =A0 =A0 =A0 =A0 .construct(InjectionType.Constructor, MyClass.class=
);

Thanks,

Mike Rettig

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

    http://xircles.codehaus.org/manage_email