コード例 #1
0
 private String getName(ClassOrInterfaceType type) {
   final String name = type.getName();
   final ClassOrInterfaceType scope = type.getScope();
   if (scope == null) {
     return name;
   } else {
     return getName(scope) + "." + name;
   }
 }
コード例 #2
0
ファイル: DefinitionVisitor.java プロジェクト: ElliotCP/701A2
  public void visit(ClassOrInterfaceDeclaration n, Object arg) {
    if (n.getJavaDoc() != null) {
      n.getJavaDoc().accept(this, arg);
    }
    printMemberAnnotations(n.getAnnotations(), arg);
    printModifiers(n.getModifiers());

    if (n.isInterface()) {
    } else {
    }

    printTypeParameters(n.getTypeParameters(), arg);

    Scope currentScope = (Scope) n.getData();
    ClassSymbol currentClass = (ClassSymbol) currentScope.resolve(n.getName());
    if (n.getExtends() != null) {
      for (Iterator<ClassOrInterfaceType> i = n.getExtends().iterator(); i.hasNext(); ) {
        ClassOrInterfaceType c = i.next();
        c.accept(this, arg);
        ClassSymbol parentClass = (ClassSymbol) currentScope.resolve((c.getName()));
        currentClass.setInheritedScope(parentClass);

        if (i.hasNext()) {}
      }
    }

    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.getMembers() != null) {
      printMembers(n.getMembers(), arg);
    }
  }