01: package net.sourceforge.pmd.rules.strings;
02:
03: import net.sourceforge.pmd.rules.AbstractPoorMethodCall;
04:
05: /**
06: */
07: public class UseIndexOfChar extends AbstractPoorMethodCall {
08:
09: private static final String targetTypeName = "String";
10: private static final String[] methodNames = new String[] {
11: "indexOf", "lastIndexOf" };
12:
13: public UseIndexOfChar() {
14: super ();
15: }
16:
17: /**
18: * Method targetTypeName.
19: * @return String
20: */
21: protected String targetTypename() {
22: return targetTypeName;
23: }
24:
25: /**
26: * Method methodNames.
27: * @return String[]
28: */
29: protected String[] methodNames() {
30: return methodNames;
31: }
32:
33: /**
34: * Method isViolationArgument.
35: * @param argIndex int
36: * @param arg String
37: * @return boolean
38: */
39: protected boolean isViolationArgument(int argIndex, String arg) {
40:
41: return isSingleCharAsString(arg);
42: }
43:
44: }
|