View Javadoc

    1   package net.sourceforge.pmd.lang.java.rule.naming;
    2
    3   import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
    4   import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclarator;
    5   import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
    6   import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
    7
    8   public class AvoidDollarSignsRule extends AbstractJavaRule {
    9
    10      public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
    11          if (node.getImage().indexOf('$') != -1) {
    12              addViolation(data, node);
    13              return data;
    14          }
    15          return super.visit(node, data);
    16      }
    17
    18      public Object visit(ASTVariableDeclaratorId node, Object data) {
    19          if (node.getImage().indexOf('$') != -1) {
    20              addViolation(data, node);
    21              return data;
    22          }
    23          return super.visit(node, data);
    24      }
    25
    26      public Object visit(ASTMethodDeclarator node, Object data) {
    27          if (node.getImage().indexOf('$') != -1) {
    28              addViolation(data, node);
    29              return data;
    30          }
    31          return super.visit(node, data);
    32      }
    33
    34  }