com.sun.javadoc.ParamTag Java Examples

The following examples show how to use com.sun.javadoc.ParamTag. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApiMethodInfo.java    From swagger-more with Apache License 2.0 5 votes vote down vote up
private void readMethodDoc() {
    hidden |= methodDoc.getRawCommentText().contains("@hidden");
    deprecated |= methodDoc.getRawCommentText().contains("@deprecated");
    if (methodDoc.tags("see").length > 0) {
        noteBuilder.append("<b> 查看 -> " + methodDoc.tags("see")[0].text() + " </b>\n");
    }
    if (!StringUtils.isEmpty(methodDoc.commentText())) {
        value = methodDoc.commentText();
    }
    if (methodDoc.tags("return").length > 0) {
        returnDescription = methodDoc.tags("return")[0].text();
    }
    for (ParamTag paramTag : methodDoc.paramTags()) {
        paramInfos.add(ApiParamInfo.fromParamTag(paramTag));
    }
    if (methodDoc.paramTags().length != parameterCount()) {
        DocLogger.warn("The number of comment parameters for method [" +
                method.getDeclaringClass().getName() + "." + method.getName() +
                "(" + parameterNames() + ")] in javadoc is incorrect");
    }
    if (paramInfos.size() != parameterCount()) {
        for (int i = paramInfos.size(); i < parameterCount(); i++) {
            String defaultName = methodDoc.parameters()[i].name();
            paramInfos.add(ApiParamInfo.defaultInfo(defaultName));
        }
    }
}
 
Example #2
Source File: MethodDocumentation.java    From spring-auto-restdocs with Apache License 2.0 5 votes vote down vote up
public static MethodDocumentation fromMethodDoc(MethodDoc methodDoc) {
    MethodDocumentation md = new MethodDocumentation();
    md.comment = methodDoc.commentText();

    for (Tag tag : methodDoc.tags()) {
        if (tag instanceof ParamTag) {
            ParamTag paramTag = (ParamTag) tag;
            md.parameters.put(paramTag.parameterName(), paramTag.parameterComment());
        } else {
            md.tags.put(cleanupTagName(tag.name()), tag.text());
        }
    }

    return md;
}
 
Example #3
Source File: DumpJavaDoc.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static boolean start(RootDoc root) throws IOException {
    String dumpFileName = readOptions(root.options());
    OutputStream os = Files.newOutputStream(Paths.get(dumpFileName));
    Properties javaDocMap = new Properties();
    for (ClassDoc classDoc : root.classes()) {
        javaDocMap.put(classDoc.toString(), classDoc.commentText());
        for (MethodDoc method : classDoc.methods()) {
            javaDocMap.put(method.qualifiedName(), method.commentText());
            for (ParamTag paramTag : method.paramTags()) {
                Parameter[] parameters = method.parameters();
                for (int i = 0; i < parameters.length; ++i) {
                    if (parameters[i].name().equals(paramTag.parameterName())) {
                        javaDocMap.put(method.qualifiedName() + ".paramCommentTag." + i,
                               paramTag.parameterComment());
                    }
                }
            }
            Tag[] retTags = method.tags("return");
            if (retTags != null && retTags.length == 1) {
                Tag retTag = method.tags("return")[0];
                javaDocMap.put(method.qualifiedName() + "." + "returnCommentTag",
                               retTag.text());
            }
        }

    }
    javaDocMap.store(os, "");
    os.flush();
    os.close();
    return true;
}
 
Example #4
Source File: ParamTagRenderer.java    From markdown-doclet with GNU General Public License v3.0 5 votes vote down vote up
private static String renderParameterName(ParamTag tag) {
    if (!tag.isTypeParameter()) {
        return tag.parameterName();
    }
    else {
        return '<' + tag.parameterName() + '>';
    }
}
 
Example #5
Source File: ApiParamInfo.java    From swagger-more with Apache License 2.0 4 votes vote down vote up
public static ApiParamInfo fromParamTag(ParamTag tag) {
    return new ApiParamInfo(tag.parameterName(), tag.parameterComment());
}
 
Example #6
Source File: SwaggerPropertiesDoclet.java    From springfox-javadoc with Apache License 2.0 4 votes vote down vote up
private static void processMethod(
  Properties properties,
  MethodDoc methodDoc,
  String defaultRequestMethod,
  String pathRoot,
  boolean exceptionRef) {

    for (AnnotationDesc annotationDesc : methodDoc.annotations()) {
        String annotationType = annotationDesc.annotationType().toString();
        if (isMapping(annotationType)) {
            StringBuilder path = new StringBuilder(pathRoot);
            for (AnnotationDesc.ElementValuePair pair : annotationDesc.elementValues()) {
                if (VALUE.equals(pair.element().name()) || PATH.equals(pair.element().name())) {
                    appendPath(path, pair);
                    break;
                }
            }
            if (!path.substring(path.length() - 1).equals(".")) {
                path.append(".");
            }
            String requestMethod = getRequestMethod(annotationDesc, annotationType, defaultRequestMethod);
            if (requestMethod != null) {
                path.append(requestMethod);
                saveProperty(properties, path.toString() + ".notes", methodDoc.commentText());

                for (ParamTag paramTag : methodDoc.paramTags()) {
                    saveProperty(properties, path.toString() + ".param." + paramTag.parameterName(),
                      paramTag.parameterComment());
                }
                for (Tag tag : methodDoc.tags()) {
                    if (tag.name().equals(RETURN)) {
                        saveProperty(properties, path.toString() + ".return", tag.text());
                        break;
                    }
                }
                if (exceptionRef) {
                    processThrows(properties, methodDoc.throwsTags(), path);
                }
            }
        }
    }
}
 
Example #7
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] typeParamTags() {
	return this.delegate.typeParamTags();
}
 
Example #8
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] typeParamTags() {
	return this.delegate.typeParamTags();
}
 
Example #9
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] paramTags() {
	return this.delegate.paramTags();
}
 
Example #10
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] typeParamTags() {
	return this.delegate.typeParamTags();
}
 
Example #11
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] paramTags() {
	return this.delegate.paramTags();
}
 
Example #12
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] typeParamTags() {
	return this.delegate.typeParamTags();
}
 
Example #13
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] paramTags() {
	return this.delegate.paramTags();
}
 
Example #14
Source File: ProgrammaticWrappingProxyInstaller.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public ParamTag[] typeParamTags() {
	return this.delegate.typeParamTags();
}
 
Example #15
Source File: ParamTagRenderer.java    From markdown-doclet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render(ParamTag tag, StringBuilder target, MarkdownDoclet doclet) {
    target.append(tag.name())
            .append(' ').append(renderParameterName(tag))
            .append(' ').append(TagRendering.simplifySingleParagraph(doclet.toHtml(tag.parameterComment())));
}