KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > rules > naming > AvoidDollarSigns


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 JavaDoc visit(ASTClassOrInterfaceDeclaration node, Object JavaDoc 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 JavaDoc visit(ASTVariableDeclaratorId node, Object JavaDoc 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 JavaDoc visit(ASTMethodDeclarator node, Object JavaDoc data) {
27         if (node.getImage().indexOf('$') != -1) {
28             addViolation(data, node);
29             return data;
30         }
31         return super.visit(node, data);
32     }
33
34 }
35
Popular Tags