|
1 |
| package net.sourceforge.pmd.properties; |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| public class IntegerProperty extends AbstractScalarProperty { |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
161
| public IntegerProperty(String theName, String theDescription, int theDefault, float theUIOrder) {
|
|
20 |
161
| super(theName, theDescription, new Integer(theDefault), theUIOrder);
|
|
21 |
| } |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
3
| public IntegerProperty(String theName, String theDescription, int[] theDefaults, float theUIOrder, int maxCount) {
|
|
32 |
3
| this(theName, theDescription, asIntegers(theDefaults), theUIOrder, maxCount);
|
|
33 |
| } |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
3
| public IntegerProperty(String theName, String theDescription, Integer[] theDefaults, float theUIOrder, int maxCount) {
|
|
44 |
3
| super(theName, theDescription, theDefaults, theUIOrder);
|
|
45 |
| |
|
46 |
3
| maxValueCount(maxCount);
|
|
47 |
| } |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
3
| private static final Integer[] asIntegers(int[] ints) {
|
|
55 |
3
| Integer[] integers = new Integer[ints.length];
|
|
56 |
12
| for (int i=0; i<ints.length; i++) integers[i] = new Integer(ints[i]);
|
|
57 |
3
| return integers;
|
|
58 |
| } |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| |
|
64 |
| |
|
65 |
3
| public Class type() {
|
|
66 |
3
| return Integer.class;
|
|
67 |
| } |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
189
| protected Object createFrom(String value) {
|
|
75 |
189
| return new Integer(value);
|
|
76 |
| } |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
2
| protected Object[] arrayFor(int size) {
|
|
84 |
2
| return new Integer[size];
|
|
85 |
| } |
|
86 |
| } |