if (hasPathAnnotation(clazz)) {
pathAnnotationExists = true;
break;
}
}
Sink sink = getSink();
sink.head();
sink.title();
sink.text("JaxRs Report");
sink.title_();
sink.head_();
sink.body();
if(pathAnnotationExists) {
for (JavaClass clazz : classes) {
if (hasPathAnnotation(clazz)) {
sink.section1();
sink.sectionTitle1();
sink.text("Class: " + clazz.getName());
sink.sectionTitle1_();
sink.lineBreak();
sink.text("Package: " + clazz.getPackage().getName());
sink.lineBreak();
sink.lineBreak();
for (Annotation annotation : clazz.getAnnotations()) {
if (annotation.getParameterValue().toString().contains("javax.ws.rs.Path")) {
sink.bold();
sink.text("Root Resource Path: " + annotation.getNamedParameter("value").toString());
sink.bold_();
}
}
sink.lineBreak();
sink.lineBreak();
sink.paragraph();
sink.text(clazz.getComment());
sink.paragraph_();
sink.section1_();
sink.horizontalRule();
for (JavaMethod mth : clazz.getMethods()) {
if (hasPathAnnotation(mth)) {
for (Annotation annotation : mth.getAnnotations()) {
if (annotation.getParameterValue().toString().contains("javax.ws.rs.Path")) {
sink.section2();
sink.sectionTitle2();
sink.text("Path: " + annotation.getNamedParameter("value"));
sink.sectionTitle2_();
}
}
for (Annotation annotation : mth.getAnnotations()) {
if (annotation.getParameterValue().toString().contains("javax.ws.rs.Produces")) {
sink.bold();
sink.text("Produces: " + annotation.getNamedParameter("value"));
sink.bold_();
sink.lineBreak();
sink.lineBreak();
} else if (annotation.getParameterValue().toString()
.contains("javax.ws.rs") && !annotation.getParameterValue().toString()
.contains("javax.ws.rs.Path")) {
sink.bold();
sink.text("Http Method: " + annotation.getType()
.toString().substring("javax.ws.rs.".length()));
sink.bold_();
sink.lineBreak();
sink.lineBreak();
}
}
sink.bold();
sink.text("Method: " + mth.getName());
sink.bold_();
sink.lineBreak();
sink.lineBreak();
sink.paragraph();
sink.text(mth.getComment());
sink.paragraph_();
DocletTag[] params = mth.getTagsByName("param");
if (params != null) {
sink.numberedList(params.length);
for (DocletTag param : params) {
sink.numberedListItem();
sink.text("param: " + param.getValue());
sink.numberedListItem_();
}
sink.numberedList_();
}
DocletTag returns = mth.getTagByName("return");
if (returns != null) {
sink.text("Returns " + returns.getValue());
}
sink.lineBreak();
sink.lineBreak();
sink.paragraph();
sink.bold();
sink.text("Method Declaration Signature: ");
sink.bold_();
sink.text(mth.getDeclarationSignature(true));
sink.paragraph_();
sink.section2_();
}
}
sink.section1_();
}
}
} else {
sink.section1();
sink.bold();
sink.text("This project doesn't expose any JaxRs resources");
sink.bold_();
sink.section1_();
}
sink.body_();
sink.flush();
sink.close();
}