KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jas > EnumElemValPair


1 /**
2  * ElemValPairs are embedded into class files
3  * and used for further ???
4  * @author $Author: Jennifer Lhotak$
5  * @version $Revision: 1.1 $
6  */

7
8 package jas;
9
10 import java.io.*;
11 import java.util.*;
12
13 public class EnumElemValPair extends ElemValPair {
14
15     AsciiCP tval;
16     AsciiCP cval;
17
18     void resolve(ClassEnv e){
19         super.resolve(e);
20         e.addCPItem(tval);
21         e.addCPItem(cval);
22     }
23
24     /**
25     * Note: An annotation attr is associated with a <em>class</em>,
26     * method or field so you need to create a new VisibilityAnnotationAttr for
27     */

28     public EnumElemValPair(String JavaDoc name, char kind, String JavaDoc tval, String JavaDoc cval) { //
29
super(name, kind);
30         this.tval = new AsciiCP(tval);
31         this.cval = new AsciiCP(cval);
32     }
33
34     int size(){
35         return super.size() + 4;
36     }
37
38
39     void write(ClassEnv e, DataOutputStream out)
40         throws IOException, jasError
41         {
42         super.write(e, out);
43         out.writeShort(e.getCPIndex(tval));
44         out.writeShort(e.getCPIndex(cval));
45     }
46 }
47
Popular Tags