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