Ejemplo n.º 1
0
  @Override
  public void visit(EnumDeclaration n, Object arg) {
    printJavadoc(n.getJavaDoc(), arg);
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());

    printer.print("enum ");
    printer.print(n.getName());

    if (n.getImplements() != null) {
      printer.print(" implements ");
      for (Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext(); ) {
        ClassOrInterfaceType c = i.next();
        c.accept(this, arg);
        if (i.hasNext()) {
          printer.print(", ");
        }
      }
    }

    printer.printLn(" {");
    printer.indent();
    if (n.getEntries() != null) {
      printer.printLn();
      for (Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext(); ) {
        EnumConstantDeclaration e = i.next();
        e.accept(this, arg);
        if (i.hasNext()) {
          printer.print(", ");
        }
      }
    }
    if (n.getMembers() != null) {
      printer.printLn(";");
      printMembers(n.getMembers(), arg);
    } else {
      if (n.getEntries() != null) {
        printer.printLn();
      }
    }
    printer.unindent();
    printer.print("}");
  }
Ejemplo n.º 2
0
  @Override
  public void visit(EnumConstantDeclaration n, Object arg) {
    printJavadoc(n.getJavaDoc(), arg);
    printMemberAnnotations(n.getAnnotations(), arg);
    printer.print(n.getName());

    if (n.getArgs() != null) {
      printArguments(n.getArgs(), arg);
    }

    if (n.getClassBody() != null) {
      printer.printLn(" {");
      printer.indent();
      printMembers(n.getClassBody(), arg);
      printer.unindent();
      printer.printLn("}");
    }
  }
 @Override
 public Void visit(EnumConstantDeclaration decl, AElement elem) {
   AField field = ((AClass) elem).fields.vivify(decl.getName());
   visitDecl(decl, field);
   return super.visit(decl, field);
 }