1 19 20 25 26 package soot.tagkit; 27 import soot.*; 28 import java.util.*; 29 30 31 35 36 public class AnnotationTag implements Tag 37 { 38 39 47 61 private String type; 62 private int visibility = 0; 63 private int numElems = 0; 64 private ArrayList elems; 65 66 70 71 public AnnotationTag(String type, int numElems){ 72 this.type = type; 73 this.numElems = numElems; 74 } 75 76 public String toString() { 78 StringBuffer sb = new StringBuffer ("Annotation: type: "+type+" num elems: "+numElems+" elems: "); 79 if (elems != null){ 80 Iterator it = elems.iterator(); 81 while (it.hasNext()){ 82 sb.append("\n"); 83 sb.append((AnnotationElem)it.next()); 84 } 85 } 86 sb.append("\n"); 87 return sb.toString(); 88 } 89 90 91 public String getName() { 92 return "AnnotationTag"; 93 } 94 95 public String getInfo(){ 96 return "Annotation"; 97 } 98 99 public String getType(){ 100 return type; 101 } 102 103 public int getVisibility(){ 104 return visibility; 105 } 106 107 public int getNumElems(){ 108 return numElems; 109 } 110 111 112 public byte[] getValue() { 113 throw new RuntimeException ( "AnnotationTag has no value for bytecode" ); 114 } 115 116 public void addElem(AnnotationElem elem){ 117 if (elems == null){ 118 elems = new ArrayList(); 119 } 120 elems.add(elem); 121 } 122 123 public void setElems(ArrayList list){ 124 this.elems = list; 125 } 126 127 public AnnotationElem getElemAt(int i){ 128 return (AnnotationElem)elems.get(i); 129 } 130 } 131 132 | Popular Tags |