1
2
3 package net.sourceforge.pmd.ast;
4
5 public class ASTThrowStatement extends SimpleNode {
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 public Object jjtAccept(JavaParserVisitor visitor, Object data) {
19 return visitor.visit(this, data);
20 }
21
22 /***
23 * Gets the image of the first ASTClassOrInterfaceType child or <code>null</code> if none is found.
24 * Note that when the statement is something like throw new Exception, this method
25 * returns 'Exception' and if the throw statement is like throw e: this method returns 'e'.
26 * A special case of returning <code>null</code> is when the throws is like throw this.e or
27 * throw this.
28 *
29 * @return the image of the first ASTClassOrInterfaceType node found or <code>null</code>
30 */
31 public final String getFirstClassOrInterfaceTypeImage() {
32 final ASTClassOrInterfaceType t = (ASTClassOrInterfaceType) getFirstChildOfType(ASTClassOrInterfaceType.class);
33 return t == null ? null : t.getImage();
34 }
35 }