KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hansel > stack > MethodInfo


1 package org.hansel.stack;
2
3 public class MethodInfo {
4     /*private MethodGen method;
5     private String className;
6
7     public MethodInfo(MethodGen methodGen) {
8         this.method = methodGen;
9         this.className = methodGen.getClassName();
10     }
11
12     public String getClassName() {
13         return className;
14     }
15
16     public StackEntry getConstant(LDC ldc) {
17         ConstantPoolGen cp = method.getConstantPool();
18         Type type = ldc.getType(getCP());
19         String constantString;
20         String stringClass = String.class.getName();
21         if ((type instanceof ObjectType)
22             && (stringClass.equals(((ObjectType)type).getClassName()))) {
23             constantString = '"' + ldc.getValue(cp).toString() + '"';
24         } else {
25             constantString = ldc.getValue(cp).toString();
26         }
27         return new StackEntry(constantString,
28                               type);
29     }
30
31     public StackEntry getConstant(LDC2_W ldc) {
32         ConstantPoolGen cp = method.getConstantPool();
33         return new StackEntry(ldc.getValue(cp).toString(),
34                               ldc.getType(getCP()));
35     }
36  
37     public StackEntry getLocalVar(LocalVariableInstruction lvi) {
38         String varName;
39         try {
40             LocalVariableTable localVars =
41                     method.getLocalVariableTable(getCP());
42             varName = localVars.getLocalVariable(lvi.getIndex()).getName();
43         } catch (NullPointerException npe) {
44             varName = "<local-" + lvi.getIndex() + ">";
45         }
46
47         return new StackEntry(varName, lvi.getType(getCP()));
48     }
49
50     public ConstantPoolGen getCP() {
51         return method.getConstantPool();
52     }*/

53 }
54
Popular Tags