public void visit(EnumDeclaration n, Object arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } printMemberAnnotations(n.getAnnotations(), arg); printModifiers(n.getModifiers()); if (n.getImplements() != null) { for (Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext(); ) { ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) {} } } if (n.getEntries() != null) { for (Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext(); ) { EnumConstantDeclaration e = i.next(); e.accept(this, arg); if (i.hasNext()) {} } } if (n.getMembers() != null) { printMembers(n.getMembers(), arg); } else { if (n.getEntries() != null) {} } }
/* * @see ASTVisitor#visit(EnumDeclaration) * @since 3.0 */ @Override public boolean visit(EnumDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } printModifiers(node.modifiers()); this.fBuffer.append("enum "); // $NON-NLS-1$ node.getName().accept(this); this.fBuffer.append(" "); // $NON-NLS-1$ if (!node.superInterfaceTypes().isEmpty()) { this.fBuffer.append("implements "); // $NON-NLS-1$ for (Iterator<Type> it = node.superInterfaceTypes().iterator(); it.hasNext(); ) { Type t = it.next(); t.accept(this); if (it.hasNext()) { this.fBuffer.append(", "); // $NON-NLS-1$ } } this.fBuffer.append(" "); // $NON-NLS-1$ } this.fBuffer.append("{"); // $NON-NLS-1$ for (Iterator<EnumConstantDeclaration> it = node.enumConstants().iterator(); it.hasNext(); ) { EnumConstantDeclaration d = it.next(); d.accept(this); // enum constant declarations do not include punctuation if (it.hasNext()) { // enum constant declarations are separated by commas this.fBuffer.append(", "); // $NON-NLS-1$ } } if (!node.bodyDeclarations().isEmpty()) { this.fBuffer.append("; "); // $NON-NLS-1$ for (Iterator<BodyDeclaration> it = node.bodyDeclarations().iterator(); it.hasNext(); ) { BodyDeclaration d = it.next(); d.accept(this); // other body declarations include trailing punctuation } } this.fBuffer.append("}"); // $NON-NLS-1$ return false; }
public void visit(EnumConstantDeclaration n, Object arg) { if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } printMemberAnnotations(n.getAnnotations(), arg); if (n.getArgs() != null) { for (Iterator<Expression> i = n.getArgs().iterator(); i.hasNext(); ) { Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) {} } } if (n.getClassBody() != null) { printMembers(n.getClassBody(), arg); } }
/* * @see ASTVisitor#visit(EnumConstantDeclaration) * @since 3.0 */ @Override public boolean visit(EnumConstantDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } printModifiers(node.modifiers()); node.getName().accept(this); if (!node.arguments().isEmpty()) { this.fBuffer.append("("); // $NON-NLS-1$ for (Iterator<Expression> it = node.arguments().iterator(); it.hasNext(); ) { Expression e = it.next(); e.accept(this); if (it.hasNext()) { this.fBuffer.append(","); // $NON-NLS-1$ } } this.fBuffer.append(")"); // $NON-NLS-1$ } if (node.getAnonymousClassDeclaration() != null) { node.getAnonymousClassDeclaration().accept(this); } return false; }