aspectify any class with CGLib
Jon Tirsén <[email protected]> 22 Jun 2003 18:34:10 +0000
| Newsgroups | gmane.comp.java.nanning.devel |
|---|---|
| Message-ID | <1056306850.6653.75.camel@localhost> |
I just commited some stuff that'll make it possible to add interceptors and mixins to any class. It uses CGLib to accomplish this: Just do: AspectInstance instance = new AspectInstance(); instance.addMixin(new MixinInstance(HelloWorld.class)); HelloWorld helloWorld = (HelloWorld) instance.getProxy(); helloWorld.helloWorld(); Where HelloWorld can be any (static) class. In this class you can also use 'this' like you would any day (ie. not Aspects.getThis()). You can at the most add one of these mixins to an AspectInstance. It's still experimental, but well, kinda cool, huh? ------------------------------------------------------- This SF.Net email is sponsored by: INetU Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php