KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jas > ClassElemValPair


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 ClassElemValPair extends ElemValPair {
14
15     AsciiCP cval;
16
17     void resolve(ClassEnv e){
18         super.resolve(e);
19         e.addCPItem(cval);
20     }
21
22     /**
23     * Note: An annotation attr is associated with a <em>class</em>,
24     * method or field so you need to create a new VisibilityAnnotationAttr for
25     */

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