use of com.github.javaparser.ast.comments.JavadocComment in project javaparser by javaparser.
the class JavadocTest method toCommentForJavadocWithTwoLinesOfJustDescriptionAndOneBlockTag.
@Test
public void toCommentForJavadocWithTwoLinesOfJustDescriptionAndOneBlockTag() {
Javadoc javadoc = new Javadoc(JavadocDescription.parseText("first line" + EOL + "second line"));
javadoc.addBlockTag("foo", "something useful");
assertEquals(new JavadocComment("" + EOL + "\t\t * first line" + EOL + "\t\t * second line" + EOL + "\t\t * " + EOL + "\t\t * @foo something useful" + EOL + "\t\t "), javadoc.toComment("\t\t"));
}
use of com.github.javaparser.ast.comments.JavadocComment in project actframework by actframework.
the class ApiManager method exploreDeclaration.
private void exploreDeclaration(ClassOrInterfaceDeclaration classDeclaration, Map<String, Javadoc> methodJavaDocs, String prefix) {
String className = classDeclaration.getName();
String newPrefix = S.blank(prefix) ? className : S.concat(prefix, ".", className);
for (Node node : classDeclaration.getChildrenNodes()) {
if (node instanceof ClassOrInterfaceDeclaration) {
exploreDeclaration((ClassOrInterfaceDeclaration) node, methodJavaDocs, newPrefix);
} else if (node instanceof MethodDeclaration) {
MethodDeclaration methodDeclaration = (MethodDeclaration) node;
List<AnnotationExpr> annoList = methodDeclaration.getAnnotations();
boolean needJavadoc = false;
if (null != annoList && !annoList.isEmpty()) {
for (AnnotationExpr anno : annoList) {
String annoName = anno.getName().getName();
if (actionAnnotations.contains(annoName)) {
needJavadoc = true;
break;
}
}
}
if (!needJavadoc) {
continue;
}
Comment comment = methodDeclaration.getComment();
if (!(comment instanceof JavadocComment)) {
continue;
}
JavadocComment javadocComment = (JavadocComment) comment;
Javadoc javadoc = JavadocParser.parse(javadocComment);
methodJavaDocs.put(S.concat(newPrefix, ".", methodDeclaration.getName()), javadoc);
}
}
}
use of com.github.javaparser.ast.comments.JavadocComment in project controller by opendaylight.
the class MbeASTVisitor method visit.
@Override
public void visit(final MethodDeclaration n, final Void arg) {
final String signature = n.getDeclarationAsString(false, false);
methods.add(signature);
final Comment c = n.getComment();
if (c instanceof JavadocComment) {
methodJavadoc.put(signature, c.toString());
}
super.visit(n, arg);
}
use of com.github.javaparser.ast.comments.JavadocComment in project javaparser by javaparser.
the class ModifierVisitor method visit.
@Override
@Generated("com.github.javaparser.generator.core.visitor.ModifierVisitorGenerator")
public Visitable visit(final JavadocComment n, final A arg) {
Comment comment = n.getComment().map(s -> (Comment) s.accept(this, arg)).orElse(null);
n.setComment(comment);
return n;
}
use of com.github.javaparser.ast.comments.JavadocComment in project javaparser by javaparser.
the class CloneVisitor method visit.
@Override
public Node visit(AnnotationMemberDeclaration _n, Object _arg) {
JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
Type type_ = cloneNodes(_n.getType(), _arg);
Expression defaultValue = cloneNodes(_n.getDefaultValue(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
AnnotationMemberDeclaration r = new AnnotationMemberDeclaration(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getModifiers(), annotations, type_, _n.getName(), defaultValue);
r.setComment(comment);
return r;
}
Aggregations