The Official BLOG and Wiki for CustomMode.com
[ start | index | login ]
start > AspectJ

AspectJ

Created by dmitry. Last edited by dmitry, 4 years and 77 days ago. Viewed 281 times. #1
[edit] [rdf]
labels
attachments
AspectJ is an open source implementation of AOP. The simplest thing it can be used for is a compilation time policy enforcement. The example that will force the compiler to produce a warning when ever System.out or System.err are referenced follows:
package com.custommode.aspectj;

/** * @author damelchenko * @since Jun 15, 2004 */ public aspect SysOutWarning { declare warning : get(* System.out) || get(* System.err): "Consider using log4j instead"; }

Similar technique can be used to enforse jdbc accerss policies e.t.c...

AspectJ has a great integration with Eclipse.

Some more advanced things that can be done with AspectJ are like implementing Multiple Inheritance in Java. Actually it's so simple with AspectJ it's hardly can be called advanced.

no comments | post comment
custommode.com | ©2000-2005
webmaster at custommode dot com