use of spoon.reflect.code.CtJavaDoc in project spoon by INRIA.
the class CommentTest method testJavadocShortAndLongComment.
@Test
public void testJavadocShortAndLongComment() {
// contract: in case we cannot determine if it is a short comment, we take the whole content
Factory f = getSpoonFactory();
CtClass<?> type = (CtClass<?>) f.Type().get(OtherJavaDoc.class);
CtJavaDoc classJavaDoc = (CtJavaDoc) type.getComments().get(0);
assertEquals("A short description without a proper end", classJavaDoc.getShortDescription());
assertEquals("A short description without a proper end", classJavaDoc.getLongDescription());
}
use of spoon.reflect.code.CtJavaDoc in project spoon by INRIA.
the class CtElementImpl method getDocComment.
public String getDocComment() {
for (CtComment ctComment : comments) {
if (ctComment.getCommentType() == CtComment.CommentType.JAVADOC) {
StringBuffer result = new StringBuffer();
result.append(ctComment.getContent() + System.lineSeparator());
for (CtJavaDocTag tag : ((CtJavaDoc) ctComment).getTags()) {
// the tag already contains a new line
result.append(tag.toString());
}
return result.toString();
}
}
return "";
}
Aggregations