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