当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationExpr.isNewNode方法代码示例

本文整理汇总了Java中org.walkmod.javalang.ast.expr.AnnotationExpr.isNewNode方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationExpr.isNewNode方法的具体用法?Java AnnotationExpr.isNewNode怎么用?Java AnnotationExpr.isNewNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.walkmod.javalang.ast.expr.AnnotationExpr的用法示例。


在下文中一共展示了AnnotationExpr.isNewNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printMemberAnnotations

import org.walkmod.javalang.ast.expr.AnnotationExpr; //导入方法依赖的package包/类
private void printMemberAnnotations(List<AnnotationExpr> annotations, Object arg) {
    if (annotations != null) {
        Node previous = null;
        Iterator<AnnotationExpr> it = annotations.iterator();
        while (it.hasNext()) {
            AnnotationExpr current = it.next();
            if (previous != null) {
                if (!previous.isNewNode() && !current.isNewNode()) {
                    addEntersBetween(previous, current);
                } else {
                    printer.printLn();
                }
            }
            current.accept(this, arg);
            previous = current;
        }
        if (!annotations.isEmpty()) {
            printer.printLn();
        }
    }
}
 
开发者ID:rpau,项目名称:javalang,代码行数:22,代码来源:DumpVisitor.java

示例2: printAnnotations

import org.walkmod.javalang.ast.expr.AnnotationExpr; //导入方法依赖的package包/类
private void printAnnotations(List<AnnotationExpr> annotations, Object arg) {
    if (annotations != null) {
        Node previous = null;
        Iterator<AnnotationExpr> it = annotations.iterator();
        while (it.hasNext()) {
            AnnotationExpr current = it.next();
            if (previous != null && !previous.isNewNode() && !current.isNewNode()) {
                addEntersBetween(previous, current);
            }
            current.accept(this, arg);
            printer.print(" ");
            previous = current;
        }
    }
}
 
开发者ID:rpau,项目名称:javalang,代码行数:16,代码来源:DumpVisitor.java

示例3: 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("}");
}
 
开发者ID:rpau,项目名称:javalang,代码行数:73,代码来源:DumpVisitor.java


注:本文中的org.walkmod.javalang.ast.expr.AnnotationExpr.isNewNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。