当前位置: 首页>>代码示例>>Java>>正文


Java JavaMethod.getComment方法代码示例

本文整理汇总了Java中com.thoughtworks.qdox.model.JavaMethod.getComment方法的典型用法代码示例。如果您正苦于以下问题:Java JavaMethod.getComment方法的具体用法?Java JavaMethod.getComment怎么用?Java JavaMethod.getComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.qdox.model.JavaMethod的用法示例。


在下文中一共展示了JavaMethod.getComment方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJavadocComments

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
protected String getJavadocComments(final ITestNGMethod method) {

        try {
            final Method m = method.getMethod();
            final String javaClass = m.getDeclaringClass().getName();
            final String javaMethod = m.getName();
            final JavaClass jc = getJavaDocBuilder(m.getDeclaringClass()).getClassByName(javaClass);
            final Class<?>[] types = method.getMethod().getParameterTypes();
            final Type[] qdoxTypes = new Type[types.length];
            for (int i = 0; i < types.length; i++) {
                final String type = getType(types[i]);
                final int dim = getDim(types[i]);
                qdoxTypes[i] = new Type(type, dim);
            }

            final JavaMethod jm = jc.getMethodBySignature(javaMethod, qdoxTypes);
            return jm.getComment();
        } catch (final Throwable e) {
            logger.error("Exception loading the javadoc comments for : " + method.getMethodName() + e);
            return null;
        }

    }
 
开发者ID:tarun3kumar,项目名称:seleniumtestsframework,代码行数:24,代码来源:SeleniumTestsReporter.java

示例2: processRestMethod

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
private void processRestMethod(JavaMethod javaMethod, String method,
                               Map<String, ObjectNode> pathMap,
                               String resourcePath, ArrayNode tagArray, ObjectNode definitions) {
    String fullPath = resourcePath, consumes = "", produces = "",
            comment = javaMethod.getComment();
    DocletTag tag = javaMethod.getTagByName("onos.rsModel");
    for (JavaAnnotation annotation : javaMethod.getAnnotations()) {
        String name = annotation.getType().getName();
        if (name.equals(PATH)) {
            fullPath = resourcePath + "/" + getPath(annotation);
            fullPath = fullPath.replaceFirst("^//", "/");
        }
        if (name.equals(CONSUMES)) {
            consumes = getIOType(annotation);
        }
        if (name.equals(PRODUCES)) {
            produces = getIOType(annotation);
        }
    }
    ObjectNode methodNode = mapper.createObjectNode();
    methodNode.set("tags", tagArray);

    addSummaryDescriptions(methodNode, comment);
    addJsonSchemaDefinition(definitions, tag);

    processParameters(javaMethod, methodNode, method, tag);

    processConsumesProduces(methodNode, "consumes", consumes);
    processConsumesProduces(methodNode, "produces", produces);
    if (tag == null || ((method.toLowerCase().equals("post") || method.toLowerCase().equals("put"))
            && !(tag.getParameters().size() > 1))) {
        addResponses(methodNode, tag, false);
    } else {
        addResponses(methodNode, tag, true);
    }

    ObjectNode operations = pathMap.get(fullPath);
    if (operations == null) {
        operations = mapper.createObjectNode();
        operations.set(method, methodNode);
        pathMap.put(fullPath, operations);
    } else {
        operations.set(method, methodNode);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:46,代码来源:OnosSwaggerMojo.java

示例3: processRestMethod

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
private void processRestMethod(JavaMethod javaMethod, String method,
                               Map<String, ObjectNode> pathMap,
                               String resourcePath, ArrayNode tagArray,
                               ObjectNode definitions, File srcDirectory) {
    String fullPath = resourcePath, consumes = "", produces = "",
            comment = javaMethod.getComment();
    DocletTag tag = javaMethod.getTagByName("onos.rsModel");
    for (JavaAnnotation annotation : javaMethod.getAnnotations()) {
        String name = annotation.getType().getName();
        if (name.equals(PATH)) {
            fullPath = resourcePath + "/" + getPath(annotation);
            fullPath = fullPath.replaceFirst("^//", "/");
        }
        if (name.equals(CONSUMES)) {
            consumes = getIOType(annotation);
        }
        if (name.equals(PRODUCES)) {
            produces = getIOType(annotation);
        }
    }
    ObjectNode methodNode = mapper.createObjectNode();
    methodNode.set("tags", tagArray);

    addSummaryDescriptions(methodNode, comment);
    addJsonSchemaDefinition(srcDirectory, definitions, tag);

    processParameters(javaMethod, methodNode, method, tag);

    processConsumesProduces(methodNode, "consumes", consumes);
    processConsumesProduces(methodNode, "produces", produces);
    if (tag == null || !(tag.getParameters().size() > 1)) {
        addResponses(javaMethod, methodNode, tag, false);
    } else {
        addResponses(javaMethod, methodNode, tag, true);
    }

    ObjectNode operations = pathMap.get(fullPath);
    if (operations == null) {
        operations = mapper.createObjectNode();
        operations.set(method, methodNode);
        pathMap.put(fullPath, operations);
    } else {
        operations.set(method, methodNode);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:46,代码来源:SwaggerGenerator.java

示例4: requiredAppearsInGetterJavadoc

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
@Test
public void requiredAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithRequired.getMethodBySignature("getRequiredProperty", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("(Required)"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例5: requiredAppearsInSetterJavadoc

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
@Test
public void requiredAppearsInSetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithRequired.getMethodBySignature("setRequiredProperty", new Type[] { new Type("java.lang.String") });
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("(Required)"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例6: descriptionAppearsInGetterJavadoc

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
@Test
public void descriptionAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithTitle.getMethodBySignature("getTitle", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TitleIT.java

示例7: descriptionAppearsInSetterJavadoc

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
@Test
public void descriptionAppearsInSetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithTitle.getMethodBySignature("setTitle", new Type[] { new Type("java.lang.String") });
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TitleIT.java

示例8: descriptionAppearsInGetterJavadoc

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
@Test
public void descriptionAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithDescription.getMethodBySignature("getDescription", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A description for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DescriptionIT.java

示例9: descriptionAppearsInSetterJavadoc

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
@Test
public void descriptionAppearsInSetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithDescription.getMethodBySignature("setDescription", new Type[] { new Type("java.lang.String") });
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A description for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DescriptionIT.java


注:本文中的com.thoughtworks.qdox.model.JavaMethod.getComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。