1 package serp.bytecode.lowlevel;
2
3 import java.io.*;
4
5 import serp.bytecode.visitor.*;
6
7
8
9
10
11
12
13
14
15
16 public class ClassEntry extends Entry implements ConstantEntry {
17 private int _nameIndex = 0;
18
19
20
21
22 public ClassEntry() {
23 }
24
25
26
27
28
29
30
31 public ClassEntry(int nameIndex) {
32 _nameIndex = nameIndex;
33 }
34
35
36
37
38
39 public int getNameIndex() {
40 return _nameIndex;
41 }
42
43
44
45
46
47 public void setNameIndex(int nameIndex) {
48 Object key = beforeModify();
49 _nameIndex = nameIndex;
50 afterModify(key);
51 }
52
53
54
55
56
57 public UTF8Entry getNameEntry() {
58 return (UTF8Entry) getPool().getEntry(_nameIndex);
59 }
60
61 public int getType() {
62 return Entry.CLASS;
63 }
64
65 public Object getConstant() {
66 return getNameEntry().getValue();
67 }
68
69 public void setConstant(Object value) {
70 getNameEntry().setConstant(value);
71 }
72
73 public void acceptVisit(BCVisitor visit) {
74 visit.enterClassEntry(this);
75 visit.exitClassEntry(this);
76 }
77
78 void readData(DataInput in) throws IOException {
79 _nameIndex = in.readUnsignedShort();
80 }
81
82 void writeData(DataOutput out) throws IOException {
83 out.writeShort(_nameIndex);
84 }
85 }