Ejemplo n.º 1
0
 /**
  * Makes the given visitor visit this annotation.
  *
  * @param av an annotation visitor. Maybe <tt>null</tt>.
  */
 public void accept(final AnnotationVisitor av) {
   if (av != null) {
     if (values != null) {
       for (int i = 0; i < values.size(); i += 2) {
         String name = (String) values.get(i);
         Object value = values.get(i + 1);
         accept(av, name, value);
       }
     }
     av.visitEnd();
   }
 }
Ejemplo n.º 2
0
 /**
  * Makes the given visitor visit a given annotation value.
  *
  * @param av an annotation visitor. Maybe <tt>null</tt>.
  * @param name the value name.
  * @param value the actual value.
  */
 static void accept(final AnnotationVisitor av, final String name, final Object value) {
   if (av != null) {
     if (value instanceof String[]) {
       String[] typeconst = (String[]) value;
       av.visitEnum(name, typeconst[0], typeconst[1]);
     } else if (value instanceof AnnotationNode) {
       AnnotationNode an = (AnnotationNode) value;
       an.accept(av.visitAnnotation(name, an.desc));
     } else if (value instanceof List) {
       AnnotationVisitor v = av.visitArray(name);
       List array = (List) value;
       for (int j = 0; j < array.size(); ++j) {
         accept(v, null, array.get(j));
       }
       v.visitEnd();
     } else {
       av.visit(name, value);
     }
   }
 }