use of com.thoughtworks.qdox.model.JavaMethod in project jsonschema2pojo by joelittlejohn.
the class DescriptionIT method descriptionAppearsInGetterJavadoc.
@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"));
}
use of com.thoughtworks.qdox.model.JavaMethod in project jsonschema2pojo by joelittlejohn.
the class TitleIT method descriptionAppearsInGetterJavadoc.
@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"));
}
use of com.thoughtworks.qdox.model.JavaMethod in project arrow by NetEase.
the class PowerEmailableReporter method getAuthors.
// ~ JavaDoc-specific Methods --------------------------------------------------------
/**
* Get ITestNGMethod author(s) string, or class author(s) if no method author is present.
* Default return value is "unknown".
*
* @param className
* @param method
* @return
* @author hzjingcheng
*/
private String getAuthors(String className, ITestNGMethod method) {
JavaClass cls = builder.getClassByName(className);
DocletTag[] authors = cls.getTagsByName("author");
// get class authors as default author name
String allAuthors = "";
if (authors.length == 0) {
allAuthors = "unknown";
} else {
for (DocletTag author : authors) {
allAuthors += author.getValue() + " ";
}
}
// get method author name
JavaMethod[] mtds = cls.getMethods();
for (JavaMethod mtd : mtds) {
if (mtd.getName().equals(method.getMethodName())) {
authors = mtd.getTagsByName("author");
if (authors.length != 0) {
allAuthors = "";
for (DocletTag author : authors) {
allAuthors += author.getValue() + " ";
}
}
break;
}
}
return allAuthors.trim();
}
use of com.thoughtworks.qdox.model.JavaMethod in project maven-plugins by apache.
the class AbstractFixJavadocMojo method isInherited.
/**
* @param clazz the Java class object, not null
* @param javaMethod the QDox JavaMethod object not null
* @return <code>true</code> if <code>javaMethod</code> exists in the given <code>clazz</code>,
* <code>false</code> otherwise.
* @see #isInherited(JavaMethod)
*/
private boolean isInherited(Class<?> clazz, JavaMethod javaMethod) {
for (Method method : clazz.getDeclaredMethods()) {
if (!method.getName().equals(javaMethod.getName())) {
continue;
}
if (method.getParameterTypes().length != javaMethod.getParameters().length) {
continue;
}
boolean found = false;
int j = 0;
for (Class<?> paramType : method.getParameterTypes()) {
String name1 = paramType.getName();
String name2 = javaMethod.getParameters()[j++].getType().getFullQualifiedName();
// TODO check algo, seems broken (only takes in account the last param)
found = name1.equals(name2);
}
return found;
}
return false;
}
use of com.thoughtworks.qdox.model.JavaMethod in project maven-plugins by apache.
the class AbstractFixJavadocMojo method updateJavadocTags.
/**
* Write tags according javaEntityTags.
*
* @param sb not null
* @param entity not null
* @param isJavaMethod
* @param javaEntityTags not null
*/
private void updateJavadocTags(final StringBuilder sb, final AbstractInheritableJavaEntity entity, final boolean isJavaMethod, final JavaEntityTags javaEntityTags) {
for (int i = 0; i < entity.getTags().length; i++) {
DocletTag docletTag = entity.getTags()[i];
if (isJavaMethod) {
JavaMethod javaMethod = (JavaMethod) entity;
String[] params = docletTag.getParameters();
if (params.length < 1) {
continue;
}
if (docletTag.getName().equals(PARAM_TAG)) {
writeParamTag(sb, javaMethod, javaEntityTags, params);
} else if (docletTag.getName().equals(RETURN_TAG)) {
writeReturnTag(sb, javaMethod, javaEntityTags);
} else if (docletTag.getName().equals(THROWS_TAG)) {
writeThrowsTag(sb, javaMethod, javaEntityTags, params);
} else {
// write unknown tags
for (Iterator<String> it = javaEntityTags.getUnknownTags().iterator(); it.hasNext(); ) {
String originalJavadocTag = it.next();
String simplified = StringUtils.removeDuplicateWhitespace(originalJavadocTag).trim();
if (simplified.contains("@" + docletTag.getName())) {
it.remove();
sb.append(originalJavadocTag);
sb.append(EOL);
}
}
}
} else {
for (Iterator<String> it = javaEntityTags.getUnknownTags().iterator(); it.hasNext(); ) {
String originalJavadocTag = it.next();
String simplified = StringUtils.removeDuplicateWhitespace(originalJavadocTag).trim();
if (simplified.contains("@" + docletTag.getName())) {
it.remove();
sb.append(originalJavadocTag);
sb.append(EOL);
}
}
}
if (sb.toString().endsWith(EOL)) {
sb.delete(sb.toString().lastIndexOf(EOL), sb.toString().length());
}
sb.append(EOL);
}
}
Aggregations