public static String translateFieldValue(List<VariableDeclarator> variables) {

    for (VariableDeclarator var : variables) {
      if (var.getInit() != null) return var.getInit().toString();
    }

    return "";
  }
  public static String translateFieldName(List<VariableDeclarator> variables) {

    for (VariableDeclarator var : variables) {
      return var.getId().toString();
    }

    return "";
  }
 public void visit(VariableDeclarationExpr n, A arg) {
   if (n.getAnnotations() != null) {
     for (AnnotationExpr a : n.getAnnotations()) {
       a.accept(this, arg);
     }
   }
   n.getType().accept(this, arg);
   for (VariableDeclarator v : n.getVars()) {
     v.accept(this, arg);
   }
 }
예제 #4
0
  public void visit(VariableDeclarationExpr n, Object arg) {
    printAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());

    n.getType().accept(this, arg);

    for (Iterator<VariableDeclarator> i = n.getVars().iterator(); i.hasNext(); ) {
      VariableDeclarator v = i.next();
      v.accept(this, arg);
      if (i.hasNext()) {}
    }
  }
예제 #5
0
  public void visit(FieldDeclaration n, Object arg) {
    if (n.getJavaDoc() != null) {
      n.getJavaDoc().accept(this, arg);
    }
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());
    n.getType().accept(this, arg);

    for (Iterator<VariableDeclarator> i = n.getVariables().iterator(); i.hasNext(); ) {
      VariableDeclarator var = i.next();
      var.accept(this, arg);
      if (i.hasNext()) {}
    }
  }
 public void visit(FieldDeclaration n, A arg) {
   if (n.getJavaDoc() != null) {
     n.getJavaDoc().accept(this, arg);
   }
   if (n.getAnnotations() != null) {
     for (AnnotationExpr a : n.getAnnotations()) {
       a.accept(this, arg);
     }
   }
   n.getType().accept(this, arg);
   for (VariableDeclarator var : n.getVariables()) {
     var.accept(this, arg);
   }
 }
예제 #7
0
 public void visit(VariableDeclarator n, Object arg) {
   n.getId().accept(this, arg);
   if (n.getInit() != null) {
     n.getInit().accept(this, arg);
   }
 }