KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > prose > jvmai > jikesrvm > advice_weaver > CodeJoinPointImpl


1 package ch.ethz.prose.jvmai.jikesrvm.advice_weaver;
2
3 import java.lang.reflect.Method JavaDoc;
4
5 import ch.ethz.jvmai.*;
6
7 import com.ibm.JikesRVM.classloader.VM_FieldReference;
8 import com.ibm.JikesRVM.classloader.VM_Method;
9
10 /**
11  * Concrete implementation of a CodeJoinPoint for the Jikes RVM. The structure
12  * is similar to the JVMDI implementation.
13  *
14  * However, some methods aren't implemented yet since they are not used in the
15  * JUnit tests of PROSE. These methods will throw a RuntimeException.
16  *
17  * @author Johann Gyger
18  */

19 public class CodeJoinPointImpl implements CodeJoinPoint, JoinPointKinds {
20
21   /**
22    * Method identifier to which this join point belongs.
23    */

24   protected int methodId;
25
26   /**
27    * Method to which this join point belongs.
28    */

29   protected Method JavaDoc method;
30
31   /**
32    * AOP tag associated with this join point.
33    */

34   protected Object JavaDoc aopTag;
35
36   /**
37    * Object on which this join point is executed (null for static methods).
38    */

39   protected Object JavaDoc this0;
40
41   /**
42    * Actual parameters of `method'.
43    */

44   protected Object JavaDoc args[];
45
46   /**
47    * Initialize this join point.
48    *
49    * @param id method identifier to which this join point belongs
50    * @param tag AOP tag associated with this join point
51    * @param this0 Object on which this join point is executed (null for static
52    * methods)
53    * @param args actual parameters of `m'
54    */

55   public void init(int id, Object JavaDoc tag, Object JavaDoc this0, Object JavaDoc[] args) {
56     methodId = id;
57     method = null;
58     aopTag = tag;
59     this.this0 = this0;
60     this.args = args;
61   }
62
63   public Object JavaDoc getAopTag() {
64     return aopTag;
65   }
66
67   public int getByteCodeIndex() {
68     throw new RuntimeException JavaDoc("Not implemented: " + getClass().getName() + ".getByteCodeIndex()");
69   }
70
71   public CodeJoinPoint getEnclosingJoinPoint() {
72     throw new RuntimeException JavaDoc("Not implemented: " + getClass().getName() + ".getEnclosingJoinPoint()");
73   }
74
75   public Method JavaDoc getMethod() {
76     if (method == null) {
77       VM_Method m = VM_FieldReference.getMemberRef(methodId).asMethodReference().resolve();
78       method = java.lang.reflect.JikesRVMSupport.createMethod(m);
79     }
80
81     return method;
82   }
83
84   public Object JavaDoc[] getArgs() {
85     return args;
86   }
87
88   public String JavaDoc getKind() {
89     return KIND_CODE_JP;
90   }
91
92   public int getMask() {
93     return MASK_CODE_JP;
94   }
95
96   public Signature getSignature() {
97     throw new RuntimeException JavaDoc("Not implemented: " + getClass().getName() + ".getSignature()");
98   }
99
100   public JoinPointStaticPart getStaticPart() {
101     throw new RuntimeException JavaDoc("Not implemented: " + getClass().getName() + ".getStaticPart()");
102   }
103
104   public Object JavaDoc getTarget() {
105     return this0;
106   }
107
108   public Object JavaDoc getThis() {
109     return this0;
110   }
111
112   public String JavaDoc toLongString() {
113     return toString();
114   }
115
116   public String JavaDoc toShortString() {
117     return toString();
118   }
119
120 }
121
Popular Tags