KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ExampleMethodRedefineAspect


1 import ch.ethz.prose.DefaultAspect;
2 import ch.ethz.prose.crosscut.Crosscut;
3 import ch.ethz.prose.crosscut.MethodRedefineCut;
4 import ch.ethz.prose.filter.PointCutter;
5 import ch.ethz.prose.filter.Within;
6 import ch.ethz.prose.crosscut.ANY;
7 import ch.ethz.prose.crosscut.REST;
8
9 /**
10  * Class ExampleMethidRedefineAspect
11  * The aspect redefines the 'bar.*' methods of the 'Foo' class.
12  *
13  * @author Angela Nicoara
14  */

15
16 public class ExampleMethodRedefineAspect extends DefaultAspect {
17
18   public Crosscut c = new MethodRedefineCut() {
19
20     public void METHOD_ARGS(Foo obj, String JavaDoc arg, REST x) {
21        System.err.println(" ->advice code: The methods 'bar.*' has been redefined. Redefine advice executed.");
22     }
23
24     protected PointCutter pointCutter() {
25        return ( (Within.method("bar.*")) .AND
26                 (Within.type("Foo.*")) );
27     }
28
29   };
30
31 }
Popular Tags