1 7 8 package jas; 9 10 import java.io.*; 11 import java.util.*; 12 13 public class ParameterVisibilityAnnotationAttr { 14 15 AsciiCP attr; 16 ArrayList list = new ArrayList(); 17 18 void resolve(ClassEnv e){ 19 e.addCPItem(attr); 20 if (list != null){ 21 Iterator it = list.iterator(); 22 while (it.hasNext()){ 23 ((VisibilityAnnotationAttr)it.next()).resolve(e); 24 } 25 } 26 } 27 28 32 public ParameterVisibilityAnnotationAttr(String kind, ArrayList vis_annotations) { attr = new AsciiCP(kind+"Annotations"); 34 list = vis_annotations; 35 } 36 37 public ParameterVisibilityAnnotationAttr() { } 39 40 public void setKind(String k){ 41 attr = new AsciiCP(k+"Annotations"); 42 } 43 44 public void addAnnotation(VisibilityAnnotationAttr annot){ 45 list.add(annot); 46 } 47 48 int size(){ 49 int i = 2; 50 if (list != null){ 51 Iterator it = list.iterator(); 52 while (it.hasNext()){ 53 i += ((VisibilityAnnotationAttr)it.next()).size(); 54 } 55 } 56 return i; 57 } 58 59 60 void write(ClassEnv e, DataOutputStream out) 61 throws IOException, jasError 62 { 63 64 out.writeShort(e.getCPIndex(attr)); 65 out.writeInt(size()); if (list == null){ 67 out.writeShort(0); 68 } 69 else { 70 out.writeShort(list.size()); 71 } 73 if (list != null){ 74 Iterator it = list.iterator(); 75 while (it.hasNext()){ 76 VisibilityAnnotationAttr vAttr = (VisibilityAnnotationAttr)it.next(); 77 if (vAttr.getList() == null){ 78 out.writeShort(0); 79 } 80 else { 81 out.writeShort(vAttr.getList().size()); 82 } 84 85 if (vAttr.getList() != null){ 86 Iterator ait = vAttr.getList().iterator(); 87 while (ait.hasNext()){ 88 ((AnnotationAttr)ait.next()).write(e,out); 89 } 90 } 91 } 92 } 93 } 94 } 95 | Popular Tags |