KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > rules > strings > UseIndexOfChar


1 package net.sourceforge.pmd.rules.strings;
2
3 import net.sourceforge.pmd.rules.AbstractPoorMethodCall;
4
5 /**
6  */

7 public class UseIndexOfChar extends AbstractPoorMethodCall {
8
9     private static final String JavaDoc targetTypeName = "String";
10     private static final String JavaDoc[] methodNames = new String JavaDoc[] { "indexOf", "lastIndexOf" };
11     
12     public UseIndexOfChar() {
13         super();
14     }
15
16     /**
17      * Method targetTypeName.
18      * @return String
19      */

20     protected String JavaDoc targetTypename() {
21         return targetTypeName;
22     }
23
24     /**
25      * Method methodNames.
26      * @return String[]
27      */

28     protected String JavaDoc[] methodNames() {
29         return methodNames;
30     }
31
32     /**
33      * Method isViolationArgument.
34      * @param argIndex int
35      * @param arg String
36      * @return boolean
37      */

38     protected boolean isViolationArgument(int argIndex, String JavaDoc arg) {
39         
40         return isSingleCharAsString(arg);
41     }
42
43 }
44
Popular Tags