View Javadoc

    1   package net.sourceforge.pmd.rules.naming;
    2
    3   import net.sourceforge.pmd.AbstractRule;
    4   import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
    5   import net.sourceforge.pmd.ast.ASTMethodDeclarator;
    6   import net.sourceforge.pmd.ast.ASTVariableDeclaratorId;
    7
    8   public class AvoidDollarSigns extends AbstractRule {
    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  }