本文整理汇总了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;
}
}
示例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);
}
}
示例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);
}
}
示例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)"));
}
示例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)"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}