1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.classfile;
18
19 import java.io.DataInput;
20 import java.io.DataOutputStream;
21 import java.io.IOException;
22
23 import org.apache.bcel.Const;
24
25
26
27
28
29
30 public final class PMGClass extends Attribute {
31
32 private int pmgClassIndex;
33 private int pmgIndex;
34
35
36
37
38
39
40
41
42
43
44 PMGClass(final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool) throws IOException {
45 this(nameIndex, length, input.readUnsignedShort(), input.readUnsignedShort(), constantPool);
46 }
47
48
49
50
51
52
53
54
55 public PMGClass(final int nameIndex, final int length, final int pmgIndex, final int pmgClassIndex, final ConstantPool constantPool) {
56 super(Const.ATTR_PMG, nameIndex, length, constantPool);
57 this.pmgIndex = pmgIndex;
58 this.pmgClassIndex = pmgClassIndex;
59 }
60
61
62
63
64
65
66
67 public PMGClass(final PMGClass pgmClass) {
68 this(pgmClass.getNameIndex(), pgmClass.getLength(), pgmClass.getPMGIndex(), pgmClass.getPMGClassIndex(), pgmClass.getConstantPool());
69 }
70
71
72
73
74
75
76
77 @Override
78 public void accept(final Visitor v) {
79 println("Visiting non-standard PMGClass object");
80 }
81
82
83
84
85 @Override
86 public Attribute copy(final ConstantPool constantPool) {
87 return (Attribute) clone();
88 }
89
90
91
92
93
94
95
96 @Override
97 public void dump(final DataOutputStream file) throws IOException {
98 super.dump(file);
99 file.writeShort(pmgIndex);
100 file.writeShort(pmgClassIndex);
101 }
102
103
104
105
106 public int getPMGClassIndex() {
107 return pmgClassIndex;
108 }
109
110
111
112
113 public String getPMGClassName() {
114 return super.getConstantPool().getConstantUtf8(pmgClassIndex).getBytes();
115 }
116
117
118
119
120 public int getPMGIndex() {
121 return pmgIndex;
122 }
123
124
125
126
127 public String getPMGName() {
128 return super.getConstantPool().getConstantUtf8(pmgIndex).getBytes();
129 }
130
131
132
133
134 public void setPMGClassIndex(final int pmgClassIndex) {
135 this.pmgClassIndex = pmgClassIndex;
136 }
137
138
139
140
141 public void setPMGIndex(final int pmgIndex) {
142 this.pmgIndex = pmgIndex;
143 }
144
145
146
147
148 @Override
149 public String toString() {
150 return "PMGClass(" + getPMGName() + ", " + getPMGClassName() + ")";
151 }
152 }