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