コード例 #1
0
 /*
  * @see ASTVisitor#visit(TypeDeclaration)
  */
 public boolean visit(TypeDeclaration node) {
   if (node.getJavadoc() != null) {
     node.getJavadoc().accept(this);
   }
   if (node.getAST().apiLevel() == AST.JLS2) {
     printModifiers(node.getModifiers());
   }
   if (node.getAST().apiLevel() >= AST.JLS3) {
     printModifiers(node.modifiers());
   }
   this.fBuffer.append("class "); // $NON-NLS-1$
   node.getName().accept(this);
   this.fBuffer.append(" "); // $NON-NLS-1$
   if (node.getAST().apiLevel() == AST.JLS2) {
     if (node.getSuperclass() != null) {
       this.fBuffer.append("extends "); // $NON-NLS-1$
       node.getSuperclass().accept(this);
       this.fBuffer.append(" "); // $NON-NLS-1$
     }
   }
   if (node.getAST().apiLevel() >= AST.JLS3) {
     if (node.getSuperclassType() != null) {
       this.fBuffer.append("extends "); // $NON-NLS-1$
       node.getSuperclassType().accept(this);
       this.fBuffer.append(" "); // $NON-NLS-1$
     }
   }
   this.fBuffer.append("{"); // $NON-NLS-1$
   for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
     BodyDeclaration d = (BodyDeclaration) it.next();
     d.accept(this);
   }
   this.fBuffer.append("}"); // $NON-NLS-1$
   return false;
 }
コード例 #2
0
 public boolean visit(TypeDeclaration node) {
   if (fBinding.getKind() == IBinding.METHOD) {
     IFunctionBinding binding = (IFunctionBinding) fBinding;
     if (binding.isConstructor() && binding.getDeclaringClass() == node.resolveBinding()) {
       fResult.add(node.getName());
     }
   }
   return true;
 }