1 package serp.bytecode;
2
3 import java.util.*;
4
5 import serp.bytecode.lowlevel.*;
6
7 /**
8 * The State type is extended by various concrete types to change
9 * the behavior of a {@link BCClass}. All methods in this base
10 * implementation throw an {@link UnsupportedOperationException}
11 *
12 * @author Abe White
13 */
14 class State {
15 /**
16 * A singleton instance of this type that can be used to make a
17 * class invalid.
18 */
19 public static final State INVALID = new State();
20
21 /**
22 * Return the magic number of the bytecode class.
23 */
24 public int getMagic() {
25 throw new UnsupportedOperationException();
26 }
27
28 /**
29 * Set the magic number of the bytecode class.
30 */
31 public void setMagic(int magic) {
32 throw new UnsupportedOperationException();
33 }
34
35 /**
36 * Return the major number of the bytecode class.
37 */
38 public int getMajorVersion() {
39 throw new UnsupportedOperationException();
40 }
41
42 /**
43 * Set the major version of the bytecode class.
44 */
45 public void setMajorVersion(int major) {
46 throw new UnsupportedOperationException();
47 }
48
49 /**
50 * Return the minor number of the bytecode class.
51 */
52 public int getMinorVersion() {
53 throw new UnsupportedOperationException();
54 }
55
56 /**
57 * Set the minor version of the bytecode class.
58 */
59 public void setMinorVersion(int minor) {
60 throw new UnsupportedOperationException();
61 }
62
63 /**
64 * Return the access flags of the bytecode class.
65 */
66 public int getAccessFlags() {
67 throw new UnsupportedOperationException();
68 }
69
70 /**
71 * Set the access flags of the bytecode class.
72 */
73 public void setAccessFlags(int access) {
74 throw new UnsupportedOperationException();
75 }
76
77 /**
78 * Return the {@link ConstantPool} index of the {@link ClassEntry}
79 * for this class, or 0 if none.
80 */
81 public int getIndex() {
82 throw new UnsupportedOperationException();
83 }
84
85 /**
86 * Set the {@link ConstantPool} index of the {@link ClassEntry}
87 * for this class.
88 */
89 public void setIndex(int index) {
90 throw new UnsupportedOperationException();
91 }
92
93 /**
94 * Return the {@link ConstantPool} index of the {@link ClassEntry}
95 * for the superclass of this class, or 0 if none.
96 */
97 public int getSuperclassIndex() {
98 throw new UnsupportedOperationException();
99 }
100
101 /**
102 * Set the {@link ConstantPool} index of the {@link ClassEntry}
103 * for the superclass of this class. Throws
104 * {@link UnsupportedOperationException} by default.
105 */
106 public void setSuperclassIndex(int index) {
107 throw new UnsupportedOperationException();
108 }
109
110 /**
111 * Return the {@link ConstantPool} indexes of the {@link ClassEntry}s
112 * for the indexes of this class, or empty collection if none. If the
113 * state does not support changing the interfaces, the returned
114 * collection should be immutable.
115 */
116 public Collection getInterfacesHolder() {
117 throw new UnsupportedOperationException();
118 }
119
120 /**
121 * Return the {@link BCField}s of this class, or empty collection if none.
122 * If the state does not support changing the fields, the returned
123 * collection should be immutable.
124 */
125 public Collection getFieldsHolder() {
126 throw new UnsupportedOperationException();
127 }
128
129 /**
130 * Return the {@link BCMethod}s of this class, or empty collection if none.
131 * If the state does not support changing the methods, the returned
132 * collection should be immutable.
133 */
134 public Collection getMethodsHolder() {
135 throw new UnsupportedOperationException();
136 }
137
138 /**
139 * Return the {@link Attribute}s of this class, or empty collection if
140 * none. If the state does not support changing the attributes, the
141 * returned collection should be immutable.
142 */
143 public Collection getAttributesHolder() {
144 throw new UnsupportedOperationException();
145 }
146
147 /**
148 * Return the constant pool of the class.
149 */
150 public ConstantPool getPool() {
151 throw new UnsupportedOperationException();
152 }
153
154 /**
155 * Return the name of the class. The name should be in a form suitable
156 * for a {@link Class#forName} call.
157 */
158 public String getName() {
159 throw new UnsupportedOperationException();
160 }
161
162 /**
163 * Return the name of the superclass. The name should be in a form
164 * suitable for a {@link Class#forName} call, or null if none.
165 */
166 public String getSuperclassName() {
167 throw new UnsupportedOperationException();
168 }
169
170 /**
171 * Return the name of the component type of this array, or null if not
172 * an array. The name should be in a form suitable for a
173 * {@link Class#forName} call.
174 */
175 public String getComponentName() {
176 throw new UnsupportedOperationException();
177 }
178
179 /**
180 * Return true if this class is a primitive.
181 */
182 public boolean isPrimitive() {
183 throw new UnsupportedOperationException();
184 }
185
186 /**
187 * Return true if this class is an array.
188 */
189 public boolean isArray() {
190 throw new UnsupportedOperationException();
191 }
192 }