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 LongProperty extends AbstractNumericProperty<Long> {
17
18 public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory<LongProperty>(Long.class, numberFieldTypesByKey) {
19
20 public LongProperty createWith(Map<String, String> valuesById) {
21 final String[] minMax = minMaxFrom(valuesById);
22 return new LongProperty(
23 nameIn(valuesById),
24 descriptionIn(valuesById),
25 Long.valueOf(minMax[0]),
26 Long.valueOf(minMax[1]),
27 Long.valueOf(numericDefaultValueIn(valuesById)),
28 0f);
29 }
30 };
31
32
33
34
35
36
37
38
39
40
41
42 public LongProperty(String theName, String theDescription, Long min, Long max, Long theDefault, float theUIOrder) {
43 super(theName, theDescription, min, max, theDefault, theUIOrder);
44 }
45
46
47
48
49
50
51
52
53
54
55
56
57
58 public LongProperty(String theName, String theDescription, String minStr, String maxStr, String defaultStr, float theUIOrder) {
59 this(theName, theDescription, longFrom(minStr), longFrom(maxStr), longFrom(defaultStr), theUIOrder);
60 }
61
62
63
64
65
66 public static Long longFrom(String numberString) {
67 return Long.valueOf(numberString);
68 }
69
70
71
72
73
74 public Class<Long> type() {
75 return Long.class;
76 }
77
78
79
80
81
82 protected Object createFrom(String value) {
83 return longFrom(value);
84 }
85 }