本文整理汇总了Java中org.walkmod.javalang.ast.expr.AnnotationExpr.getEndLine方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationExpr.getEndLine方法的具体用法?Java AnnotationExpr.getEndLine怎么用?Java AnnotationExpr.getEndLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.walkmod.javalang.ast.expr.AnnotationExpr
的用法示例。
在下文中一共展示了AnnotationExpr.getEndLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.walkmod.javalang.ast.expr.AnnotationExpr; //导入方法依赖的package包/类
public void visit(EnumDeclaration n, Object arg) {
prepareComments(n);
Node comment = n.getJavaDoc();
if (comment != null) {
printPreviousComments(comment, arg);
}
printJavadoc((JavadocComment) comment, arg);
printPreviousComments(n, arg);
List<AnnotationExpr> annotations = n.getAnnotations();
printMemberAnnotations(annotations, arg);
int beginLineMembers = n.getBeginLine();
if (annotations != null && !annotations.isEmpty()) {
AnnotationExpr last = annotations.get(annotations.size() - 1);
if (!last.isNewNode()) {
beginLineMembers = last.getEndLine() + 1;
}
}
printModifiers(n.getModifiers());
printer.print("enum ");
printer.print(n.getName());
if (n.getImplements() != null) {
printer.print(" implements ");
for (Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext();) {
ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(" {");
if (n.isNewNode()) {
printer.printLn();
}
printer.indent();
List<EnumConstantDeclaration> entries = n.getEntries();
if (entries != null) {
if (n.isNewNode()) {
printer.printLn();
} else {
printFirstBlankLines(n, entries, beginLineMembers);
}
}
printChildrenNodes(n, entries, ", ", arg);
List<BodyDeclaration> members = n.getMembers();
if (members != null && !members.isEmpty()) {
printer.printLn(";");
if (entries != null && !entries.isEmpty() && !members.isEmpty()) {
EnumConstantDeclaration lastEntry = entries.get(entries.size() - 1);
if (!lastEntry.isNewNode()) {
printFirstBlankLines(n, members, lastEntry.getEndLine() + 1);
}
}
printChildrenNodes(n, members, null, arg);
printEntersAfterMembersAndBeforeComments(n, members);
printContainingCommentsAndEnters(n, members, arg, beginLineMembers);
} else {
printContainingCommentsAndEnters(n, entries, arg, n.getBeginLine());
}
printer.unindent();
printer.print("}");
}