Package com.sun.javadoc

Examples of com.sun.javadoc.ClassDoc


    emitDescription(enclosing, classDoc, classDoc.firstSentenceTags(),
        classDoc.inlineTags());
    emitOutOfLineTags(classDoc.tags());
    emitModifiers(classDoc);

    ClassDoc superclassDoc = classDoc.superclass();
    if (superclassDoc != null) {
      beginln("superclass", "ref", getId(superclassDoc));
      text(superclassDoc.name());
      endln();
    }

    ClassDoc[] superinterfacesDoc = classDoc.interfaces();
    for (int i = 0; i < superinterfacesDoc.length; i++) {
      ClassDoc superinterfaceDoc = superinterfacesDoc[i];
      beginln("superinterface", "ref", getId(superinterfaceDoc));
      text(superinterfaceDoc.name());
      endln();
    }

    ClassDoc[] cda = classDoc.innerClasses();
    for (int i = 0; i < cda.length; i++) {
View Full Code Here


        MethodDoc methodDoc = (MethodDoc) memberDoc;
        MethodDoc superMethodDoc = methodDoc.overriddenMethod();

        if (superMethodDoc == null) {

          ClassDoc classDocToTry = methodDoc.containingClass();
          while (classDocToTry != null) {
            // See if this is a method from an interface.
            // If so, borrow its description.
            //
            superMethodDoc = findMatchingInterfaceMethodDoc(
                classDocToTry.interfaces(), methodDoc);

            if (superMethodDoc != null) {
              break;
            }

            classDocToTry = classDocToTry.superclass();
          }
        }

        if (superMethodDoc != null) {
          // Borrow the description from the superclass/superinterface.
          //
          memberDoc = superMethodDoc;
        }
      }
    } else if (memberDoc instanceof ConstructorDoc) {
      beginln("constructor");
      emitIdentity(getId(memberDoc), memberDoc.containingClass().name());
      emitLocation(memberDoc);
    } else {
      throw new IllegalStateException("What kind of executable member is this?");
    }

    emitDescription(enclosing, memberDoc, memberDoc.firstSentenceTags(),
        memberDoc.inlineTags());
    emitOutOfLineTags(memberDoc.tags());
    emitModifiers(memberDoc);

    begin("flatSignature");
    text(memberDoc.flatSignature());
    end();

    // Return type if it's a method
    //
    if (memberDoc instanceof MethodDoc) {
      emitType(((MethodDoc) memberDoc).returnType());
    }

    // Parameters
    //
    beginln("params");
    Parameter[] pda = memberDoc.parameters();
    for (int i = 0; i < pda.length; i++) {
      Parameter pd = pda[i];

      begin("param");
      emitType(pd.type());
      begin("name");
      text(pd.name());
      end();
      end();
    }
    endln();

    // Exceptions thrown
    //
    ClassDoc[] tea = memberDoc.thrownExceptions();
    if (tea.length > 0) {
      beginln("throws");
      for (int i = 0; i < tea.length; ++i) {
        ClassDoc te = tea[i];
        beginln("throw", "ref", getId(te));
        text(te.name());
        endln();
      }
      endln();
    }
View Full Code Here

    // Top-level classes
    //
    ClassDoc[] cda = packageDoc.allClasses();
    for (int i = 0; i < cda.length; i++) {
      ClassDoc cd = cda[i];

      // Make sure we have source.
      //
      SourcePosition p = cd.position();
      if (p == null || p.line() == 0) {
        // Skip this since it isn't ours (otherwise we would have source).
        //
        continue;
      }

      if (cd.containingClass() == null) {
        process(cd, cda[i]);
      } else {
        // Not a top-level class.
        //
        cd = cda[i];
View Full Code Here

      // Create a list of the packages to iterate over.
      //
      HashSet packageNames = new HashSet();
      ClassDoc[] cda = initialRootDoc.classes();
      for (int i = 0; i < cda.length; i++) {
        ClassDoc cd = cda[i];
        // Only top-level classes matter.
        //
        if (cd.containingClass() == null) {
          packageNames.add(cd.containingPackage().name());
        }
      }

      // Packages
      //
View Full Code Here

    }
  }

  private void processSeeTag(SeeTag seeTag) {
    String ref = null;
    ClassDoc cd = null;
    PackageDoc pd = null;
    MemberDoc md = null;
    String title = null;

    // Check for HTML links
    if (seeTag.text().startsWith("<")) {
      // TODO: ignore for now
      return;
    }
    // Ordered: most-specific to least-specific
    if (null != (md = seeTag.referencedMember())) {
      ref = getId(md);
    } else if (null != (cd = seeTag.referencedClass())) {
      ref = getId(cd);

      // See if the target has a title.
      //
      Tag[] titleTag = cd.tags("@title");
      if (titleTag.length > 0) {
        title = titleTag[0].text().trim();
        if (title.length() == 0) {
          title = null;
        }
View Full Code Here

    } else {
      className = linkText;
      methodSig = null;
    }

    ClassDoc containingClass = null;
    Doc holder = tag.holder();
    if (holder instanceof ClassDoc) {
      containingClass = (ClassDoc) holder;
    } else if (holder instanceof MemberDoc) {
      containingClass = ((MemberDoc) holder).containingClass();
    }

    ClassDoc targetClass = null;
    if (className.length() == 0) {
      targetClass = containingClass;
    } else if (holder instanceof PackageDoc) {
      targetClass = ((PackageDoc) holder).findClass(className);
    } else {
      targetClass = containingClass.findClass(className);
    }

    if (targetClass == null) {
      if (classResolver != null) {
        targetClass = classResolver.findClass(className);
      }
      if (targetClass == null) {
        System.err.println(tag.position().toString()
            + ": unable to resolve class " + className + " for " + tag);
        System.exit(1);
      }
    }

    if (methodSig == null) {
      return targetClass.position();
    }

    String paramSig = methodSig.substring(methodSig.indexOf('(') + 1,
        methodSig.lastIndexOf(')'));
    String[] resolvedParamTypes;
    if (paramSig.length() > 0) {
      String[] unresolvedParamTypes = paramSig.split("\\s*,\\s*");
      resolvedParamTypes = new String[unresolvedParamTypes.length];
      for (int i = 0; i < unresolvedParamTypes.length; ++i) {
        ClassDoc paramType = containingClass.findClass(unresolvedParamTypes[i]);
        if (paramType == null && classResolver != null) {
          paramType = classResolver.findClass(unresolvedParamTypes[i]);
        }
        if (paramType == null) {
          System.err.println(tag.position().toString()
              + ": unable to resolve class " + unresolvedParamTypes[i]
              + " for " + tag);
          System.exit(1);
        }
        resolvedParamTypes[i] = paramType.qualifiedTypeName();
      }
    } else {
      resolvedParamTypes = new String[0];
    }

View Full Code Here

        }
    }

    private void addRelatedClasses(ClassDoc type) {
        // Generalization
        ClassDoc superType = type.superclass();
        if (superType != null &&
            !superType.qualifiedName().equals("java.lang.Object") &&
            !superType.qualifiedName().equals("java.lang.Annotation") &&
            !superType.qualifiedName().equals("java.lang.Enum")) {
            addNode(superType, false);
            addEdge(new Edge(GENERALIZATION, type, superType));
        }

        // Realization
View Full Code Here

            for (Edge edge: directEdges) {
                if (!useSee && edge.getType() == SEE_ALSO) {
                    continue;
                }

                ClassDoc source = (ClassDoc) edge.getSource();
                ClassDoc target = (ClassDoc) edge.getTarget();

                boolean excluded = false;
                if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
                    for (Tag t: pkg.tags(TAG_EXCLUDE)) {
                        Pattern p = Pattern.compile(t.text().trim());

                        if (p.matcher(source.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                        if (p.matcher(target.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                    }
                    if (excluded) {
                        continue;
                    }
                }

                for (Tag t: cls.tags(TAG_EXCLUDE)) {
                    Pattern p = Pattern.compile(t.text().trim());

                    if (p.matcher(source.qualifiedName()).find()) {
                        excluded = true;
                        break;
                    }
                    if (p.matcher(target.qualifiedName()).find()) {
                        excluded = true;
                        break;
                    }
                }
                if (excluded) {
                    continue;
                }

                edgesToRender.add(edge);
                nodesToRender.put(source.qualifiedName(), source);
                nodesToRender.put(target.qualifiedName(), target);
            }

            Set<Edge> reversedDirectEdges = reversedEdges.get(cls);
            if (reversedDirectEdges != null) {
                for (Edge edge: reversedDirectEdges) {
                    if (!useSee && edge.getType() == SEE_ALSO) {
                        continue;
                    }

                    ClassDoc source = (ClassDoc) edge.getSource();
                    ClassDoc target = (ClassDoc) edge.getTarget();

                    boolean excluded = false;
                    if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
                        for (Tag t: pkg.tags(TAG_EXCLUDE)) {
                            Pattern p = Pattern.compile(t.text().trim());

                            if (p.matcher(source.qualifiedName()).find()) {
                                excluded = true;
                                break;
                            }
                            if (p.matcher(target.qualifiedName()).find()) {
                                excluded = true;
                                break;
                            }
                        }
                        if (excluded) {
                            continue;
                        }
                    }

                    for (Tag t: cls.tags(TAG_EXCLUDE)) {
                        Pattern p = Pattern.compile(t.text().trim());

                        if (p.matcher(source.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                        if (p.matcher(target.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                    }
                    if (excluded) {
                        continue;
                    }

                    edgesToRender.add(edge);
                    nodesToRender.put(source.qualifiedName(), source);
                    nodesToRender.put(target.qualifiedName(), target);
                }
            }
        }
    }
View Full Code Here

        }
    }

    private void addRelatedClasses(ClassDoc type) {
        // Generalization
        ClassDoc superType = type.superclass();
        if (superType != null &&
            !superType.qualifiedName().equals("java.lang.Object") &&
            !superType.qualifiedName().equals("java.lang.Annotation") &&
            !superType.qualifiedName().equals("java.lang.Enum")) {
            addNode(superType, false);
            addEdge(new Edge(GENERALIZATION, type, superType));
        }

        // Realization
View Full Code Here

            for (Edge edge: directEdges) {
                if (!useSee && edge.getType() == SEE_ALSO) {
                    continue;
                }

                ClassDoc source = (ClassDoc) edge.getSource();
                ClassDoc target = (ClassDoc) edge.getTarget();

                boolean excluded = false;
                if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
                    for (Tag t: pkg.tags(TAG_EXCLUDE)) {
                        Pattern p = Pattern.compile(t.text().trim());

                        if (p.matcher(source.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                        if (p.matcher(target.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                    }
                    if (excluded) {
                        continue;
                    }
                }

                for (Tag t: cls.tags(TAG_EXCLUDE)) {
                    Pattern p = Pattern.compile(t.text().trim());

                    if (p.matcher(source.qualifiedName()).find()) {
                        excluded = true;
                        break;
                    }
                    if (p.matcher(target.qualifiedName()).find()) {
                        excluded = true;
                        break;
                    }
                }
                if (excluded) {
                    continue;
                }

                if (!useHidden || source.tags(TAG_HIDDEN).length == 0 && target.tags(TAG_HIDDEN).length == 0) {
                    edgesToRender.add(edge);
                }
                if (!useHidden || source.tags(TAG_HIDDEN).length == 0) {
                    nodesToRender.put(source.qualifiedName(), source);
                }
                if (!useHidden || target.tags(TAG_HIDDEN).length == 0) {
                    nodesToRender.put(target.qualifiedName(), target);
                }
            }

            Set<Edge> reversedDirectEdges = reversedEdges.get(cls);
            if (reversedDirectEdges != null) {
                for (Edge edge: reversedDirectEdges) {
                    if (!useSee && edge.getType() == SEE_ALSO) {
                        continue;
                    }

                    ClassDoc source = (ClassDoc) edge.getSource();
                    ClassDoc target = (ClassDoc) edge.getTarget();

                    boolean excluded = false;
                    if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
                        for (Tag t: pkg.tags(TAG_EXCLUDE)) {
                            Pattern p = Pattern.compile(t.text().trim());

                            if (p.matcher(source.qualifiedName()).find()) {
                                excluded = true;
                                break;
                            }
                            if (p.matcher(target.qualifiedName()).find()) {
                                excluded = true;
                                break;
                            }
                        }
                        if (excluded) {
                            continue;
                        }
                    }

                    for (Tag t: cls.tags(TAG_EXCLUDE)) {
                        Pattern p = Pattern.compile(t.text().trim());

                        if (p.matcher(source.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                        if (p.matcher(target.qualifiedName()).find()) {
                            excluded = true;
                            break;
                        }
                    }
                    if (excluded) {
                        continue;
                    }

                    if (!useHidden || source.tags(TAG_HIDDEN).length == 0 && target.tags(TAG_HIDDEN).length == 0) {
                        edgesToRender.add(edge);
                    }
                    if (!useHidden || source.tags(TAG_HIDDEN).length == 0) {
                        nodesToRender.put(source.qualifiedName(), source);
                    }
                    if (!useHidden || target.tags(TAG_HIDDEN).length == 0) {
                        nodesToRender.put(target.qualifiedName(), target);
                    }
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.javadoc.ClassDoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.