示例#1
0
 @SuppressWarnings("unchecked")
 public static void accept(String name, Object v, DexAnnotationVisitor av) {
   if (v instanceof AnnotationNode) {
     AnnotationNode a = (AnnotationNode) v;
     DexAnnotationVisitor av1 = av.visitAnnotation(name, a.type);
     accept(a.items, av1);
     av1.visitEnd();
   } else if (v instanceof Field) {
     Field e = (Field) v;
     av.visitEnum(name, e.getOwner(), e.getName());
   } else if (v instanceof List) {
     List<Object> list = (List<Object>) v;
     DexAnnotationVisitor av1 = av.visitArray(name);
     for (Object i : list) {
       accept(null, i, av1);
     }
     av1.visitEnd();
   } else if (v instanceof Field) {
     Field e = (Field) v;
     av.visitEnum(name, e.getOwner(), e.getName());
   } else if (v instanceof Method) {
     // Method method = (Method) v;
     // AnnotationVisitor av1 = av.visitAnnotation(item.name, "Lcom.googlecode.Method;");
     // av1.visit("owner", method.getOwner());
     // av1.visit("name", method.getName());
     // av1.visit("desc", method.getType().getDesc());
     // av1.visitEnd();
     av.visit(name, v);
   } else {
     av.visit(name, v);
   }
 }
示例#2
0
 public void accept(DexAnnotationAble a) {
   DexAnnotationVisitor av = a.visitAnnotation(type, visible);
   accept(items, av);
   av.visitEnd();
 }