01: package net.sourceforge.pmd.rules.naming;
02:
03: import net.sourceforge.pmd.AbstractRule;
04: import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
05: import net.sourceforge.pmd.ast.ASTMethodDeclarator;
06: import net.sourceforge.pmd.ast.ASTVariableDeclaratorId;
07:
08: public class AvoidDollarSigns extends AbstractRule {
09:
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: }
|