public CompilationUnit getResult() {
   List<ImportDeclaration> importDecls = new ArrayList<ImportDeclaration>();
   for (String type : imports) {
     ImportDeclaration importDecl = new ImportDeclaration();
     importDecl.setName(new NameExpr(type));
     importDecls.add(importDecl);
   }
   cu.setImports(importDecls);
   return cu;
 }
 public void visit(CompilationUnit n, A arg) {
   if (n.getPackage() != null) {
     n.getPackage().accept(this, arg);
   }
   if (n.getImports() != null) {
     for (ImportDeclaration i : n.getImports()) {
       i.accept(this, arg);
     }
   }
   if (n.getTypes() != null) {
     for (TypeDeclaration typeDeclaration : n.getTypes()) {
       typeDeclaration.accept(this, arg);
     }
   }
 }
示例#3
0
 public void visit(CompilationUnit n, Object arg) {
   if (n.getPackage() != null) {
     n.getPackage().accept(this, arg);
   }
   if (n.getImports() != null) {
     for (ImportDeclaration i : n.getImports()) {
       i.accept(this, arg);
     }
   }
   if (n.getTypes() != null) {
     for (Iterator<TypeDeclaration> i = n.getTypes().iterator(); i.hasNext(); ) {
       i.next().accept(this, arg);
       if (i.hasNext()) {}
     }
   }
 }
示例#4
0
 public void visit(ImportDeclaration n, Object arg) {
   if (n.isStatic()) {}
   n.getName().accept(this, arg);
   if (n.isAsterisk()) {}
 }
 public void visit(ImportDeclaration n, A arg) {
   n.getName().accept(this, arg);
 }