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. ASTClassOrInterfaceBodyDeclaration.java */
5   
6   package net.sourceforge.pmd.lang.java.ast;
7   
8   import net.sourceforge.pmd.Rule;
9   
10  public class ASTClassOrInterfaceBodyDeclaration extends AbstractJavaNode implements CanSuppressWarnings {
11  
12      public ASTClassOrInterfaceBodyDeclaration(int id) {
13          super(id);
14      }
15  
16      public ASTClassOrInterfaceBodyDeclaration(JavaParser p, int id) {
17          super(p, id);
18      }
19  
20      @Override
21      public boolean isFindBoundary() {
22  	return isAnonymousInnerClass();
23      }
24  
25      public boolean hasSuppressWarningsAnnotationFor(Rule rule) {
26          for (int i = 0; i < jjtGetNumChildren(); i++) {
27              if (jjtGetChild(i) instanceof ASTAnnotation) {
28                  ASTAnnotation a = (ASTAnnotation) jjtGetChild(i);
29                  if (a.suppresses(rule)) {
30                      return true;
31                  }
32              }
33          }
34          return false;
35      }
36  
37      /**
38       * Accept the visitor. *
39       */
40      public Object jjtAccept(JavaParserVisitor visitor, Object data) {
41          return visitor.visit(this, data);
42      }
43  
44      public boolean isAnonymousInnerClass() {
45          return jjtGetParent().jjtGetParent() instanceof ASTAllocationExpression;
46      }
47  
48      public boolean isEnumChild() {
49          return jjtGetParent().jjtGetParent() instanceof ASTEnumConstant;
50      }
51  }