Jeremy Rayner on java and other stuff.

All | AudioDrama | Chatter | Fun | Groovy | Java | Life

EasyContainer - a simple wrapper
Posted on 21 Jan 2004
All this PicoContainer stuff reminds me of the excellent article from DrDobbs Journal a couple of years ago called new Considered Harmful [ <-- good read]

With my foray into the Pico stuff, I thought it would be a good idea to simplify (for my lazy benefit) the bit that is basically doing the 'new', or the 'instatiation management' or some other term... that you can find at the core of any Type3 IoC framework.

I've put together a little wrapper around pico to start with, and possibly other containers that provide 'instatiation management', and at joe's suggestion (and fear of hecklers) I'll share the source to you lot to play with.

This wrapper is not breaking new ground, in fact is only putting simple method names round existing methods in pico, and removing the knowledge of container from your code (for the simple stuff). But it has got me thinking about the general case of 'instatiation management' as a replacement for new, and my next wander around the javaverse could include looking into The Java Syntactic Extender to provide a new syntax for making this as easy to use as new (irrespective of container)

JavaDocs,source code, and the prebuilt easy.jar

EasyContainer pico = new EasyContainer(new DefaultPicoContainer());
pico.reg(Boy.class);
pico.reg(Girl.class);
Girl girl = (Girl)pico.get(Girl.class);

Any thoughts...
P.S. My own critic inside says "Oh my god, he's written commons-logging generic wrapper equivalent for type3 containers" - but I might as well publish this anyways ;-)

21 Jan 2004 |

 

 
January 2004
SunMonTueWedThuFriSat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Prev | Today | Next

rss:subscribe (All)



What I'm reading
my feed aggregator ->box

My websites
London Java Meetups
Programming Projects
Elite in Java
megg
Blogmento
Jez's Photos
Fantasy Stock Market
Cool Saxophonist
Doctor Who Audios
Pisces Audios

Other Blogs
Mike Cannon-Brookes
James Strachan
Joe Walnes
Sam Dalton
Simon Brown
Cameron Purdy
Mike Roberts
Erik C. Thauvin
John Martin
Manfred Riem

B5 d++ t++ k s+ u- f
i+ o+ x-- e+ l- c--

powered by blogmento