jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Padraic I. Hannon" <...@wasabicowboy.com>
Subject Re: dynamic mixins and jcr mapping
Date Wed, 29 Aug 2007 17:10:30 GMT
I was playing with cglib over the last few days and found their mixin 
proxy. Using that I was able to do a simple test:

Dog dog = new DogImpl();
Cat cat = new CatImpl();

Object[] delegates = new Object[2];
delegates[0] = dog;
delegates[1] = cat;
Object mixed = net.sf.cglib.proxy.Mixin.(delegates);

System.out.println(((Dog)mixed).bark());
System.out.println(((Cat)mixed).meow());

Seems to work fine. You can even add a mixin to a mixin...

Horse horse = new HorseImpl();
delegates[0] = mixed;
delegates[1] = horse;
mixed = net.sf.cglib.proxy.Mixin.(delegates);

System.out.println(((Horse)mixed).neigh());
System.out.println(((Dog)mixed).bark());

I was thinking that one could create base classes which would be mixin 
implementations and add those during de-serialization from ocm or even 
at runtime to node objects. I'll keep playing and get back with more 
once I have something more concrete.

-paddy

Mime
View raw message