KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > alt > jiapi > file > Interface


1 package alt.jiapi.file;
2
3 import java.util.List JavaDoc;
4
5 /**
6  * This class represents an Interface, as described in Java Virtual
7  * Machine Specification, 2nd edition, chapter 4.1.
8  */

9 public class Interface {
10     // NOTE: This class acts as a container to one short.
11
// We could have this optimized into an array of shorts
12
// instead of a List of Interfaces.
13
// @see ClassFile for how this is used at the moment
14
private ConstantPool cp;
15     private short constant_class_index;
16     
17     public Interface(ConstantPool cp, short constant_class_index) {
18         this.cp = cp;
19         this.constant_class_index = constant_class_index;
20     }
21     
22     public short getConstantClassIndex() {
23         return constant_class_index;
24     }
25
26     public ConstantPool.ClassInfo getClassInfo() {
27         return (ConstantPool.ClassInfo)cp.get(constant_class_index);
28     }
29
30     public String JavaDoc getName() {
31         ConstantPool.ClassInfo cInfo = getClassInfo();
32         return cInfo.getName();
33     }
34 }
35
36
37
Popular Tags