KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > samples > bench > NullAC


1 package org.objectweb.jac.samples.bench;
2
3 import org.aopalliance.intercept.ConstructorInvocation;
4 import org.aopalliance.intercept.MethodInvocation;
5 import org.objectweb.jac.core.AspectComponent;
6 import org.objectweb.jac.core.Wrapper;
7 import org.objectweb.jac.core.Interaction;
8
9 public class NullAC extends AspectComponent {
10
11     /**
12      * Simple sample of configuration method which wraps methods
13      *
14      * @param n number of pointcuts to create
15      * @param wrappeeExpr the objects to wrap
16      * @param wrappeeClassExpr the classes to wrap
17      * @param wrappeeMethodExpr the methods to wrap
18      */

19
20     public void wrap(
21         int n,
22         String JavaDoc wrappeeExpr,
23         String JavaDoc wrappeeClassExpr,
24         String JavaDoc wrappeeMethodExpr) {
25         for (; n > 0; n--) {
26             pointcut(
27                 wrappeeExpr,
28                 wrappeeClassExpr,
29                 wrappeeMethodExpr,
30                 NullWrapper.class.getName(),
31                 "doProceed",
32                 null,
33                 false);
34         }
35     }
36
37     public class NullWrapper extends Wrapper {
38         public NullWrapper(AspectComponent ac) {
39             super(ac);
40         }
41         public Object JavaDoc doProceed(Interaction interaction) {
42             //System.out.print("+");
43
return proceed(interaction);
44         }
45         public Object JavaDoc invoke(MethodInvocation invocation) throws Throwable JavaDoc {
46             return doProceed((Interaction) invocation);
47         }
48         public Object JavaDoc construct(ConstructorInvocation invocation)
49             throws Throwable JavaDoc {
50             return doProceed((Interaction) invocation);
51         }
52     }
53 }
54
Popular Tags