View Javadoc

1   /* Generated By:JJTree: Do not edit this line. ASTThrowStatement.java */
2   
3   package net.sourceforge.pmd.lang.java.ast;
4   
5   public class ASTThrowStatement extends AbstractJavaNode {
6       public ASTThrowStatement(int id) {
7           super(id);
8       }
9   
10      public ASTThrowStatement(JavaParser p, int id) {
11          super(p, id);
12      }
13  
14  
15      /**
16       * Accept the visitor. *
17       */
18      @Override
19      public Object jjtAccept(JavaParserVisitor visitor, Object data) {
20          return visitor.visit(this, data);
21      }
22  
23      /**
24       * Gets the image of the first ASTClassOrInterfaceType child or <code>null</code> if none is found.
25       * Note that when the statement is something like throw new Exception, this method
26       * returns 'Exception' and if the throw statement is like throw e: this method returns 'e'.
27       * A special case of returning <code>null</code> is when the throws is like throw this.e or
28       * throw this.
29       * <p/>
30       * TODO - use symbol table (?)
31       *
32       * @return the image of the first ASTClassOrInterfaceType node found or <code>null</code>
33       */
34      public final String getFirstClassOrInterfaceTypeImage() {
35          final ASTClassOrInterfaceType t = getFirstDescendantOfType(ASTClassOrInterfaceType.class);
36          return t == null ? null : t.getImage();
37      }
38  }