Package com.sun.javadoc

Examples of com.sun.javadoc.Parameter


            for (int j = 0; j < params.length; j++) {
                if (j > 0) {
                    buff.append(", ");
                }
                buffSignature.append('_');
                Parameter param = params[j];
                boolean isVarArgs = method.isVarArgs() && j == params.length - 1;
                String typeName = getTypeName(false, isVarArgs, param.type());
                buff.append(typeName);
                buffSignature.append(StringUtils.replaceAll(typeName, "[]", "-"));
                buff.append(' ');
                buff.append(param.name());
            }
            buff.append(')');
            if (isDeprecated(method)) {
                name = "<span class=\"deprecated\">" + name + "</span>";
            }
View Full Code Here


    // 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();
View Full Code Here

                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>");
                    }
                }

View Full Code Here

         */
        if (parameters != null && paramTags != null
                && parameters.length == paramTags.length) {

            for (int i = 0; i < parameters.length; i++) {
                final Parameter parameter = parameters[i];

                /* TODO: this only works if the params and tags are in the same
                 * order. If the param tags are mixed up, the comments for parameters
                 * will be wrong.
                 */
                final ParamTag paramTag = paramTags[i];

                final ParamDocType paramDocType = new ParamDocType();
                paramDocType.setParamName(paramTag.parameterName());
                paramDocType.setCommentText(paramTag.parameterComment());
                docProcessor.processParamTag(paramTag, parameter, paramDocType);

                AnnotationDesc[] annotations = parameter.annotations();
                if (annotations != null) {
                    for (AnnotationDesc annotationDesc : annotations) {
                        final AnnotationDocType annotationDocType = new AnnotationDocType();
                        final String typeName = annotationDesc.annotationType().qualifiedName();
                        annotationDocType.setAnnotationTypeName(typeName);
View Full Code Here

        function.setAttribute("description", method.commentText());
        function.setAttribute("type", method.returnType().typeName());

        Parameter[] params = method.parameters();
        for (int k = 0; k < params.length; k++) {
          Parameter param = params[k];
          Element parameter = document.createElement("parameter");
          parameter.setAttribute("name", param.name());
          parameter.setAttribute("type", param.typeName());
          function.appendChild(parameter);
        }

        String name = method.name();
        String description = method.getRawCommentText();
View Full Code Here

         */
        if (parameters != null && paramTags != null
                && parameters.length == paramTags.length) {

            for (int i = 0; i < parameters.length; i++) {
                final Parameter parameter = parameters[i];

                /* TODO: this only works if the params and tags are in the same
                 * order. If the param tags are mixed up, the comments for parameters
                 * will be wrong.
                 */
                final ParamTag paramTag = paramTags[i];

                final ParamDocType paramDocType = new ParamDocType();
                paramDocType.setParamName(paramTag.parameterName());
                paramDocType.setCommentText(paramTag.parameterComment());
                docProcessor.processParamTag(paramTag, parameter, paramDocType);

                final AnnotationDesc[] annotations = parameter.annotations();
                if (annotations != null) {
                    for (final AnnotationDesc annotationDesc : annotations) {
                        final AnnotationDocType annotationDocType = new AnnotationDocType();
                        final String typeName = annotationDesc.annotationType().qualifiedName();
                        annotationDocType.setAnnotationTypeName(typeName);
View Full Code Here

    }
    // and methods
    for (MethodDoc method : formDoc.methods(false)) {
      if (!method.returnType().qualifiedTypeName().equals("void") || method.parameters().length != 1 || !method.name().startsWith("set"))
        continue;
      Parameter parameter = method.parameters()[0];
      final AnnotationDesc pathParamAnnotation = Utils.findParameterAnnotation(method, parameter, 0, PathParam.class);
      if (pathParamAnnotation != null) {
        String name = (String) Utils.getAnnotationValue(pathParamAnnotation);
        pathParameters.add(new FormMethodParameter(method, pathParamAnnotation, MethodParameterType.Path));
        continue;
      }
      final AnnotationDesc matrixParamAnnotation = Utils.findParameterAnnotation(method, parameter, 0, MatrixParam.class);
      if (matrixParamAnnotation != null) {
        String name = (String) Utils.getAnnotationValue(matrixParamAnnotation);
        matrixParameters.add(new FormMethodParameter(method, matrixParamAnnotation, MethodParameterType.Matrix));
        continue;
      }
      final AnnotationDesc queryParamAnnotation = Utils.findParameterAnnotation(method, parameter, 0, QueryParam.class);
      if (queryParamAnnotation != null) {
        String name = (String) Utils.getAnnotationValue(queryParamAnnotation);
        queryParameters.add(new FormMethodParameter(method, queryParamAnnotation, MethodParameterType.Query));
        continue;
      }
      final AnnotationDesc headerParamAnnotation = Utils.findParameterAnnotation(method, parameter, 0, HeaderParam.class);
      if (headerParamAnnotation != null) {
        String name = (String) Utils.getAnnotationValue(headerParamAnnotation);
        headerParameters.add(new FormMethodParameter(method, headerParamAnnotation, MethodParameterType.Header));
        continue;
      }
      final AnnotationDesc cookieParamAnnotation = Utils.findParameterAnnotation(method, parameter, 0, CookieParam.class);
      if (cookieParamAnnotation != null) {
        String name = (String) Utils.getAnnotationValue(cookieParamAnnotation);
        cookieParameters.add(new FormMethodParameter(method, cookieParamAnnotation, MethodParameterType.Cookie));
        continue;
      }
      final AnnotationDesc formParamAnnotation = Utils.findParameterAnnotation(method, parameter, 0, FormParam.class);
      if (formParamAnnotation != null) {
        String name = (String) Utils.getAnnotationValue(formParamAnnotation);
        formParameters.add(new FormMethodParameter(method, formParamAnnotation, MethodParameterType.Form));
        continue;
      }
      // I'm not sure if @Form can be used on setter methods on an @Form field, but just in case...
      if(formClass != null) {
        //recurse into @Form parameters
        final AnnotationDesc formAnnotation = Utils.findParameterAnnotation(method, parameter, 0, formClass);
        if(formAnnotation != null) {
            walkFormParameter(parameter.type().asClassDoc());
            continue;
        }
      }
      final AnnotationDesc contextAnnotation = Utils.findParameterAnnotation(method, parameter, 0, Context.class);
      if (contextAnnotation == null) {
View Full Code Here

    this.parameterIndex = parameterIndex;
  }

  @Override
  public String getDoc() {
    Parameter overriddenParameter = method.parameters()[parameterIndex];
    for (ParamTag paramTag : method.paramTags()) {
      if (overriddenParameter.name().equals(paramTag.parameterName()))
        return paramTag.parameterComment();
    }
    return "";
  }
View Full Code Here

    return method;
  }

  @Override
  public Tag[] getFirstSentenceTags() {
    Parameter overriddenParameter = method.parameters()[parameterIndex];
    for (ParamTag paramTag : method.paramTags()) {
      if (overriddenParameter.name().equals(paramTag.parameterName()))
        return paramTag.firstSentenceTags();
    }
    return method.firstSentenceTags();
  }
View Full Code Here

    if (p1.length != p2.length) {
      return false;
    }
    for (int i = 0; i < p1.length; i++) {
      Parameter pi1 = p1[i];
      Parameter pi2 = p2[i];

      if (!pi1.typeName().equals(pi2.typeName())) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of com.sun.javadoc.Parameter

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.