use of com.thoughtworks.qdox.model.JavaClass in project maven-plugins by apache.
the class AbstractFixJavadocMojoTest method testReplaceLinkTags_OnlyAnchor.
public void testReplaceLinkTags_OnlyAnchor() throws Throwable {
String comment = "/** There's a {@link #getClass()} but no setClass() */";
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class OnlyAnchor {}";
JavaClass clazz = getJavaSource(source).getClassByName("OnlyAnchor");
String newComment = AbstractFixJavadocMojo.replaceLinkTags(comment, clazz);
assertEquals("/** There's a {@link #getClass()} but no setClass() */", newComment);
}
use of com.thoughtworks.qdox.model.JavaClass in project arrow by NetEase.
the class NeXMLSuiteResultWriter method getTestMethodAttr.
private String getTestMethodAttr(String attr, String className, ITestNGMethod method) {
logger.info("className = " + className);
String value = "";
JavaClass cls = builder.getClassByName(className);
JavaMethod[] mtds = cls.getMethods();
logger.info("JavaMethod = " + mtds.toString());
for (JavaMethod mtd : mtds) {
if (mtd.getName().equals(method.getMethodName())) {
Annotation[] annotations = mtd.getAnnotations();
logger.info("Annotation = " + annotations.toString());
for (Annotation ant : annotations) {
logger.info("Annotation.getClass().getName() = " + ant.getClass().getName());
String clss = ant.getType().getFullyQualifiedName();
if (clss.equals("org.testng.annotations.Test")) {
Map<String, String> map = ant.getNamedParameterMap();
if (map.containsKey(attr)) {
value = map.get(attr);
value = value.substring(1, value.length() - 1);
}
}
}
break;
}
}
return value;
}
use of com.thoughtworks.qdox.model.JavaClass in project arrow by NetEase.
the class NeXMLSuiteResultWriter method getAuthors.
/**
* 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) {
logger.info("className = " + className);
JavaClass cls = builder.getClassByName(className);
DocletTag[] authors = cls.getTagsByName("author");
logger.info("authors = " + authors.toString());
// get class authors as default author name
String allAuthors = "";
if (authors.length == 0) {
allAuthors = "";
} else {
for (DocletTag author : authors) {
allAuthors += author.getValue() + " ";
}
}
// get method author name
JavaMethod[] mtds = cls.getMethods();
logger.info("JavaMethod = " + mtds.toString());
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.JavaClass in project jsonschema2pojo by joelittlejohn.
the class JavaNameIT method originalPropertyNamesAppearInJavaDoc.
@Test
public void originalPropertyNamesAppearInJavaDoc() throws IOException {
schemaRule.generateAndCompile("/schema/javaName/javaName.json", "com.example.javaname");
File generatedJavaFile = schemaRule.generated("com/example/javaname/JavaName.java");
JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
javaDocBuilder.addSource(generatedJavaFile);
JavaClass classWithDescription = javaDocBuilder.getClassByName("com.example.javaname.JavaName");
JavaField javaPropertyField = classWithDescription.getFieldByName("javaProperty");
assertThat(javaPropertyField.getComment(), containsString("Corresponds to the \"propertyWithJavaName\" property."));
JavaField javaEnumField = classWithDescription.getFieldByName("javaEnum");
assertThat(javaEnumField.getComment(), containsString("Corresponds to the \"enumWithJavaName\" property."));
JavaField javaObjectField = classWithDescription.getFieldByName("javaObject");
assertThat(javaObjectField.getComment(), containsString("Corresponds to the \"objectWithJavaName\" property."));
}
use of com.thoughtworks.qdox.model.JavaClass in project geronimo-xbean by apache.
the class QdoxMappingLoader method loadElements.
private List<ElementMapping> loadElements(JavaDocBuilder builder) {
JavaSource[] javaSources = builder.getSources();
List<ElementMapping> elements = new ArrayList<ElementMapping>();
for (JavaSource javaSource : javaSources) {
if (javaSource.getClasses().length == 0) {
log.info("No Java Classes defined in: " + javaSource.getURL());
} else {
JavaClass[] classes = javaSource.getClasses();
for (JavaClass javaClass : classes) {
ElementMapping element = loadElement(builder, javaClass);
if (element != null && !javaClass.isAbstract()) {
elements.add(element);
} else {
log.debug("No XML annotation found for type: " + javaClass.getFullyQualifiedName());
}
}
}
}
return elements;
}
Aggregations