本文整理汇总了Java中com.github.javaparser.ast.expr.Expression.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Expression.accept方法的具体用法?Java Expression.accept怎么用?Java Expression.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.expr.Expression
的用法示例。
在下文中一共展示了Expression.accept方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printArguments
import com.github.javaparser.ast.expr.Expression; //导入方法依赖的package包/类
private void printArguments(final NodeList<Expression> args, final Void arg) {
printer.print("(");
Position cursorRef = printer.getCursor();
if (!isNullOrEmpty(args)) {
for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) {
final Expression e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
printer.print(",");
if (configuration.isColumnAlignParameters()) {
printer.wrapToColumn(cursorRef.column);
} else {
printer.print(" ");
}
}
}
}
printer.print(")");
}
示例2: visit
import com.github.javaparser.ast.expr.Expression; //导入方法依赖的package包/类
@Override
public void visit(final ArrayInitializerExpr n, final Object arg) {
printer.printLn("ArrayInitializerExpr");
printJavaComment(n.getComment(), arg);
printer.print("{");
if (n.getValues() != null) {
printer.print(" ");
for (final Iterator<Expression> i = n.getValues().iterator(); i.hasNext(); ) {
final Expression expr = i.next();
expr.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
printer.print(" ");
}
printer.print("}");
}
示例3: visit
import com.github.javaparser.ast.expr.Expression; //导入方法依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final A arg) {
visitComment(n.getComment(), arg);
if (!n.isThis() && n.getExpr() != null) {
n.getExpr().accept(this, arg);
}
if (n.getTypeArguments() != null) {
for (final Type t : n.getTypeArguments()) {
t.accept(this, arg);
}
}
if (n.getArgs() != null) {
for (final Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
}
示例4: getVisitorFactory
import com.github.javaparser.ast.expr.Expression; //导入方法依赖的package包/类
@Override
public Function<PrettyPrinterConfiguration, PrettyPrintVisitor> getVisitorFactory() {
return configuration -> new PrettyPrintVisitor(configuration) {
@Override
public void visit(ArrayInitializerExpr n, Void arg) {
if (arrayLiteralMembersOnSeparateLines) {
if (configuration.isPrintJavaDoc()) {
n.getComment().ifPresent(c -> c.accept(this, arg));
}
printer.print("{");
if (!isNullOrEmpty(n.getValues())) {
printer.println();
printer.indent();
for (final Iterator<Expression> i = n.getValues().iterator(); i.hasNext(); ) {
final Expression expr = i.next();
expr.accept(this, arg);
if (i.hasNext()) {
printer.println(",");
}
}
printer.println();
printer.unindent();
}
printer.print("}");
} else {
super.visit(n, arg);
}
}
};
}
示例5: printArguments
import com.github.javaparser.ast.expr.Expression; //导入方法依赖的package包/类
public void printArguments(final List<Expression> args, final Object arg) {
printer.print("(");
if (!isNullOrEmpty(args)) {
for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) {
final Expression e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
printer.print(", ");
}
}
}
printer.print(")");
}