Exemplo n.º 1
0
 /**
  * Print a list of annotations on separate lines, ending with a newline.
  *
  * @param annotations list of {@link AnnotationExpr annotation expressions}
  * @param arg argument provided to the calling visitor method
  */
 private void printMemberAnnotations(List<AnnotationExpr> annotations, Object arg) {
   if (annotations != null) {
     for (AnnotationExpr a : annotations) {
       a.accept(this, arg);
       printer.printLn();
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Print a list of annotations. The final parameter determines whether to issue a leading (if
  * true) or trailing (if false) space.
  *
  * @param annotations list of {@link AnnotationExpr annotation expressions}
  * @param arg argument provided to the calling visitor method
  * @param isOnReceiver whether annotation is on a method receiver
  */
 private void printAnnotations(
     List<AnnotationExpr> annotations, Object arg, boolean isOnReceiver) {
   if (annotations != null) {
     Iterator<AnnotationExpr> i = annotations.iterator();
     if (i.hasNext()) {
       AnnotationExpr a = i.next();
       if (isOnReceiver) {
         printer.print(" ");
       }
       a.accept(this, arg);
       while (i.hasNext()) {
         printer.print(" ");
         a = i.next();
         a.accept(this, arg);
       }
       if (!isOnReceiver) {
         printer.print(" ");
       }
     }
   }
 }