1
2
3
4 package net.sourceforge.pmd.lang.rule.properties;
5
6 import java.util.Map;
7
8 import net.sourceforge.pmd.PropertyDescriptorFactory;
9 import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescriptorFactory;
10
11
12
13
14
15
16 public class BooleanProperty extends AbstractScalarProperty<Boolean> {
17
18 public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory<BooleanProperty>(
19 Boolean.class) {
20
21 public BooleanProperty createWith(Map<String, String> valuesById) {
22 return new BooleanProperty(nameIn(valuesById), descriptionIn(valuesById),
23 Boolean.valueOf(defaultValueIn(valuesById)), 0f);
24 }
25 };
26
27
28
29
30
31
32
33
34
35 public BooleanProperty(String theName, String theDescription, Boolean defaultValue, float theUIOrder) {
36 super(theName, theDescription, Boolean.valueOf(defaultValue), theUIOrder);
37 }
38
39
40
41
42
43
44
45
46
47
48 public BooleanProperty(String theName, String theDescription, String defaultBoolStr, float theUIOrder) {
49 this(theName, theDescription, Boolean.valueOf(defaultBoolStr), theUIOrder);
50 }
51
52
53
54
55
56 public Class<Boolean> type() {
57 return Boolean.class;
58 }
59
60
61
62
63 protected String defaultAsString() {
64 return Boolean.toString(defaultValue());
65 }
66
67
68
69
70
71
72
73 protected Object createFrom(String value) {
74 return Boolean.valueOf(value);
75 }
76 }