Package com.sun.javadoc

Examples of com.sun.javadoc.MethodDoc


        return false;
    }

    private static Type getReturnType(ExecutableMemberDoc method) {
        if (method instanceof MethodDoc) {
            MethodDoc m = (MethodDoc) method;
            return m.returnType();
        }
        return null;
    }
View Full Code Here


    if (doc.isFinal()) {
      beginEndln("isFinal");
    }

    if (doc instanceof MethodDoc) {
      MethodDoc methodDoc = (MethodDoc) doc;

      if (methodDoc.isAbstract()) {
        beginEndln("isAbstract");
      }

      if (methodDoc.isSynchronized()) {
        beginEndln("isSynchronized");
      }
    }
  }
View Full Code Here

      //
      for (int intfIndex = 0; intfIndex < interfaces.length; ++intfIndex) {
        ClassDoc currentIntfDoc = interfaces[intfIndex];
        MethodDoc[] intfMethodDocs = currentIntfDoc.methods();
        for (int methodIndex = 0; methodIndex < intfMethodDocs.length; ++methodIndex) {
          MethodDoc intfMethodDoc = intfMethodDocs[methodIndex];
          String methodDocName = methodDoc.name();
          String intfMethodDocName = intfMethodDoc.name();
          if (methodDocName.equals(intfMethodDocName)) {
            if (methodDoc.signature().equals(intfMethodDoc.signature())) {
              // It's a match!
              //
              return intfMethodDoc;
            }
          }
        }

        // Try the superinterfaces of this interface.
        //
        MethodDoc foundMethodDoc = findMatchingInterfaceMethodDoc(
            currentIntfDoc.interfaces(), methodDoc);
        if (foundMethodDoc != null) {
          return foundMethodDoc;
        }
      }
View Full Code Here

      //
      String rawComment = memberDoc.getRawCommentText();
      if (rawComment.length() == 0) {
        // Switch out the member doc being used.
        //
        MethodDoc methodDoc = (MethodDoc) memberDoc;
        MethodDoc superMethodDoc = methodDoc.overriddenMethod();

        if (superMethodDoc == null) {

          ClassDoc classDocToTry = methodDoc.containingClass();
          while (classDocToTry != null) {
View Full Code Here

    String possibleOverloads = "";

    MethodDoc[] methods = targetClass.methods();
    outer : for (int i = 0; i < methods.length; ++i) {
      MethodDoc methodDoc = methods[i];
      if (methodSig.startsWith(methodDoc.name())) {
        possibleOverloads += "\n" + methodDoc.flatSignature();
        Parameter[] tryParams = methodDoc.parameters();
        if (resolvedParamTypes.length != tryParams.length) {
          // param count mismatch
          continue outer;
        }
        for (int j = 0; j < tryParams.length; ++j) {
          if (!tryParams[j].type().qualifiedTypeName().equals(
              resolvedParamTypes[j])) {
            // param type mismatch
            continue outer;
          }
        }
        return methodDoc.position();
      }
    }

    System.err.println(tag.position().toString()
        + ": unable to resolve method for " + tag);
View Full Code Here

  public boolean overrides(MethodDoc doc) {
    return doc.equals(overriddenMethod());
  }

  public ClassDoc overriddenClass() {
    MethodDoc methodDoc = overriddenMethod();
    return methodDoc!=null ? methodDoc.containingClass() : null;
  }
View Full Code Here

  }

  public MethodDoc overriddenMethod() {
    ClassDoc superClass = containingClass().superclass();
    while (superClass!=null) {
      MethodDoc superMethodDoc = getSuperMethodDoc(superClass);
      if (superMethodDoc!=null)
        return superMethodDoc;
      superClass = superClass.superclass();
    }
    return null;
View Full Code Here

  }

  private List<String> insertJavadoc(File file,
      List<MethodDoc> methodDocs, List<String> lines) {
    for (int i = 0; i < methodDocs.size(); i++) {
      MethodDoc md = methodDocs.get(i);

      int insertLineNo;

      if (i + 1 < methodDocs.size()) {
        insertLineNo = findCommentLine(lines, md, methodDocs.get(i + 1)
            .position().line());
      } else {
        insertLineNo = findCommentLine(lines, md, m_typelines.get(file)
            .intValue());
      }

      int realInsert = insertLineNo == 0 ? md.position().line() - 1
          : insertLineNo;

      if (insertLineNo == 0) {
        lines.add(realInsert, "    */");
      }
View Full Code Here

            if (matcher.matches()) {
                nameTypeDescriptionList.add(new NameTypeDescription(matcher.group(1), matcher.group(2), matcher.group(3)));
            } else {
                String error = "Invalid " + tag.name() + " tag format \"" + text + "\" for ";
                if (tag.holder() instanceof MethodDoc) {
                    MethodDoc methodDoc = (MethodDoc) tag.holder();
                    error += "verb " + methodDoc.name() + " of component " + methodDoc.containingClass().simpleTypeName();
                } else if (tag.holder() instanceof ClassDoc) {
                    ClassDoc classDoc = (ClassDoc) tag.holder();
                    error += "component " + classDoc.simpleTypeName();
                } else {
                    error += "unknown Doc type";
View Full Code Here

            mOut.println("&nbsp;<P>");
            mOut.println("<TABLE BORDER=\"1\" WIDTH=\"100%\" CELLPADDING=\"3\" CELLSPACING=\"0\" SUMMARY=\"\">");
            mOut.println("<TR BGCOLOR=\"#CCCCFF\"><TH ALIGN=\"left\" COLSPAN=\"2\"><FONT SIZE=\"+2\"><B>Methods Detail</B></FONT></TH></TR>");
            mOut.println("</TABLE>");
            for (int m = 0; m < methodDocs.length; m++) {
                MethodDoc methodDoc = methodDocs[m];
                String methodName = methodDoc.name();

                // get return type
                String returnTypeString = getTypeString(methodDoc.returnType());
                int returnTypeLength = returnTypeString.replaceAll("<.*?>", "").replace("&lt;", "<").replace("&gt;", ">").length(); // length without HTML tags and &gt;/&lt; entities

                Parameter[] parameters = methodDoc.parameters();
                String[] parameterSignatures = new String[parameters.length];
                for (int i = 0; i < parameterSignatures.length; i++) {
                    Parameter parameter = parameters[i];
                    parameterSignatures[i] = getTypeString(parameter.type()) + " " + parameter.name();
                }
                String parameterSeparator = ",\n";
                for (int i = 0; i < returnTypeLength + methodName.length() + 2; i++) {
                    parameterSeparator += " ";
                }
               
               
                // begin output
                mOut.println("<A NAME=\"" + methodName + "\"><A NAME=\"" + methodName + methodDoc.flatSignature() + "\"> <H3>" + methodName + "</H3></A></A>");
                mOut.print("<PRE>" + returnTypeString + " <B>" + methodName + "</B>(" + Strings.join(parameterSignatures, parameterSeparator) + ")");

                Type[] exceptions = methodDoc.thrownExceptionTypes();
                if (exceptions.length > 0) {
                    String[] exceptionNames = new String[exceptions.length];
                    for (int i = 0; i < exceptions.length; i++) {
                        exceptionNames[i] = getTypeString(exceptions[i]);
                    }
                  mOut.print(parameterSeparator.substring(1, parameterSeparator.length() - 7) + "throws " + Strings.join(exceptionNames, parameterSeparator));
                }
                mOut.println("</PRE>");
                mOut.print("<DL><DD>");
                printInlineTags(methodDoc.inlineTags(), classDoc);

                mOut.println("<P><DD><DL>");

                // param tags
                ParamTag[] paramTags = methodDoc.paramTags();
                if (parameters.length > 0) {
                    mOut.println("<DT><B>Parameters:</B></DT>");
                    for (Parameter parameter : parameters) {
                        ParamTag paramTag = null;
                        for (ParamTag tag : paramTags) {
                            if (tag.parameterName().equals(parameter.name())) {
                                paramTag = tag;
                            }
                        }
                        mOut.println("<DD><CODE>" + parameter.name() + "</CODE> - ");
                        if (paramTag != null) {
                            if (!paramTag.parameterComment().isEmpty()) {
                                printInlineTags(paramTag.inlineTags(), classDoc);
                            } else {
                                System.out.println("No description in @param tag for " + parameter.name() + " in " + classDoc.name() + "." + methodDoc.name());
                            }
                        } else {
                            System.out.println("No @param tag for " + parameter.name() + " in " + classDoc.name() + "." + methodDoc.name());
                        }
                        mOut.println("</DD>");
                    }
                }

                // return tag
                Tag[] returnTags = methodDoc.tags("@return");
                if (returnTags.length > 0) {
                    mOut.println("<DT><B>Returns:</B></DT>");
                    mOut.println("<DD>" + returnTags[0].text() + "</DD>");
                }

                // throws tag
                ThrowsTag[] throwsTags = methodDoc.throwsTags();
                if (throwsTags.length > 0) {
                    mOut.println("<DT><B>Throws:</B></DT>");
                    for (ThrowsTag throwsTag: throwsTags) {
                        String exceptionName = throwsTag.exceptionName();
                        // remove "com.qspin.qtaste.testsuite." prefix if any
View Full Code Here

TOP

Related Classes of com.sun.javadoc.MethodDoc

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.