本文整理汇总了Java中com.github.javaparser.ast.stmt.CatchClause.accept方法的典型用法代码示例。如果您正苦于以下问题:Java CatchClause.accept方法的具体用法?Java CatchClause.accept怎么用?Java CatchClause.accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.stmt.CatchClause
的用法示例。
在下文中一共展示了CatchClause.accept方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.stmt.CatchClause; //导入方法依赖的package包/类
@Override public void visit(final TryStmt n, final A arg) {
visitComment(n.getComment(), arg);
if (n.getResources() != null) {
for (final VariableDeclarationExpr v : n.getResources()) {
v.accept(this, arg);
}
}
n.getTryBlock().accept(this, arg);
if (n.getCatchs() != null) {
for (final CatchClause c : n.getCatchs()) {
c.accept(this, arg);
}
}
if (n.getFinallyBlock() != null) {
n.getFinallyBlock().accept(this, arg);
}
}
示例2: visit
import com.github.javaparser.ast.stmt.CatchClause; //导入方法依赖的package包/类
@Override public void visit(final TryStmt n, final A arg) {
jw.write(n);
visitComment(n.getComment(), arg);
if (n.getResources() != null) {
for (final VariableDeclarationExpr v : n.getResources()) {
v.accept(this, arg);
}
}
n.getTryBlock().accept(this, arg);
if (n.getCatchs() != null) {
for (final CatchClause c : n.getCatchs()) {
c.accept(this, arg);
}
}
if (n.getFinallyBlock() != null) {
n.getFinallyBlock().accept(this, arg);
}
}
示例3: visit
import com.github.javaparser.ast.stmt.CatchClause; //导入方法依赖的package包/类
@Override
public void visit(final TryStmt n, final Void arg) {
if (canAddNewLine(n)) printer.println();
printJavaComment(n.getComment(), arg);
printer.print("try ");
if (!n.getResources().isEmpty()) {
printer.print("(");
Iterator<Expression> resources = n.getResources().iterator();
boolean first = true;
while (resources.hasNext()) {
resources.next().accept(this, arg);
if (resources.hasNext()) {
printer.print(";");
printer.println();
if (first) {
printer.indent();
}
}
first = false;
}
if (n.getResources().size() > 1) {
printer.unindent();
}
printer.print(") ");
}
n.getTryBlock().accept(this, arg);
for (final CatchClause c : n.getCatchClauses()) {
c.accept(this, arg);
}
if (n.getFinallyBlock().isPresent()) {
printer.print(" finally ");
n.getFinallyBlock().get().accept(this, arg);
}
if (getNext(n) != null) printer.println();
}
示例4: visit
import com.github.javaparser.ast.stmt.CatchClause; //导入方法依赖的package包/类
@Override
public void visit(final TryStmt n, final Object arg) {
printer.printLn("TryStmt");
printJavaComment(n.getComment(), arg);
printer.print("try ");
if (!n.getResources().isEmpty()) {
printer.print("(");
Iterator<VariableDeclarationExpr> resources = n.getResources().iterator();
boolean first = true;
while (resources.hasNext()) {
visit(resources.next(), arg);
if (resources.hasNext()) {
printer.print(";");
printer.printLn();
if (first) {
printer.indent();
}
}
first = false;
}
if (n.getResources().size() > 1) {
printer.unindent();
}
printer.print(") ");
}
n.getTryBlock().accept(this, arg);
if (n.getCatchs() != null) {
for (final CatchClause c : n.getCatchs()) {
c.accept(this, arg);
}
}
if (n.getFinallyBlock() != null) {
printer.print(" finally ");
n.getFinallyBlock().accept(this, arg);
}
}
示例5: visit
import com.github.javaparser.ast.stmt.CatchClause; //导入方法依赖的package包/类
@Override public void visit(final TryStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print("try ");
if (!n.getResources().isEmpty()) {
printer.print("(");
Iterator<VariableDeclarationExpr> resources = n.getResources().iterator();
boolean first = true;
while (resources.hasNext()) {
visit(resources.next(), arg);
if (resources.hasNext()) {
printer.print(";");
printer.printLn();
if (first) {
printer.indent();
}
}
first = false;
}
if (n.getResources().size() > 1) {
printer.unindent();
}
printer.print(") ");
}
n.getTryBlock().accept(this, arg);
if (n.getCatchs() != null) {
for (final CatchClause c : n.getCatchs()) {
c.accept(this, arg);
}
}
if (n.getFinallyBlock() != null) {
printer.print(" finally ");
n.getFinallyBlock().accept(this, arg);
}
}
示例6: visit
import com.github.javaparser.ast.stmt.CatchClause; //导入方法依赖的package包/类
@Override public void visit(final TryStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
printer.print("try ");
if (!n.getResources().isEmpty()) {
printer.print("(");
Iterator<VariableDeclarationExpr> resources = n.getResources().iterator();
boolean first = true;
while (resources.hasNext()) {
visit(resources.next(), arg);
if (resources.hasNext()) {
printer.print(";");
printer.printLn();
if (first) {
printer.indent();
}
}
first = false;
}
if (n.getResources().size() > 1) {
printer.unindent();
}
printer.print(") ");
}
n.getTryBlock().accept(this, arg);
if (n.getCatchs() != null) {
for (final CatchClause c : n.getCatchs()) {
c.accept(this, arg);
}
}
if (n.getFinallyBlock() != null) {
printer.print(" finally ");
n.getFinallyBlock().accept(this, arg);
}
}