View Javadoc

    1   /* Generated By:JJTree: Do not edit this line. ASTTryStatement.java */
    2
    3   package net.sourceforge.pmd.ast;
    4
    5
    6   public class ASTTryStatement extends SimpleJavaNode {
    7
    8       public ASTTryStatement(int id) {
    9           super(id);
    10      }
    11
    12      public ASTTryStatement(JavaParser p, int id) {
    13          super(p, id);
    14      }
    15
    16      /**
    17       * Accept the visitor. *
    18       */
    19      public Object jjtAccept(JavaParserVisitor visitor, Object data) {
    20          return visitor.visit(this, data);
    21      }
    22
    23      public boolean hasFinally() {
    24          for (int i = 0; i < this.jjtGetNumChildren(); i++) {
    25              if (jjtGetChild(i) instanceof ASTFinallyStatement) {
    26                  return true;
    27              }
    28          }
    29          return false;
    30      }
    31
    32      public ASTFinallyStatement getFinally() {
    33          for (int i = 0; i < this.jjtGetNumChildren(); i++) {
    34              if (jjtGetChild(i) instanceof ASTFinallyStatement) {
    35                  return (ASTFinallyStatement) jjtGetChild(i);
    36              }
    37          }
    38          throw new RuntimeException("ASTTryStatement.getFinally called but this try stmt doesn't contain a finally block");
    39      }
    40
    41  }