1 package serp.bytecode;
2
3 import serp.bytecode.visitor.*;
4 import serp.util.*;
5
6
7
8
9
10
11
12 public class LocalVariable extends Local {
13 LocalVariable(LocalVariableTable owner) {
14 super(owner);
15 }
16
17
18
19
20 public LocalVariableTable getLocalVariableTable() {
21 return (LocalVariableTable) getTable();
22 }
23
24
25
26
27
28 public Class getType() {
29 String type = getTypeName();
30 if (type == null)
31 return null;
32 return Strings.toClass(type, getClassLoader());
33 }
34
35
36
37
38
39 public BCClass getTypeBC() {
40 String type = getTypeName();
41 if (type == null)
42 return null;
43 return getProject().loadClass(type, getClassLoader());
44 }
45
46
47
48
49 public void setType(Class type) {
50 if (type == null)
51 setType((String) null);
52 else
53 setType(type.getName());
54 }
55
56
57
58
59 public void setType(BCClass type) {
60 if (type == null)
61 setType((String) null);
62 else
63 setType(type.getName());
64 }
65
66 public void acceptVisit(BCVisitor visit) {
67 visit.enterLocalVariable(this);
68 visit.exitLocalVariable(this);
69 }
70 }