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