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 DoubleMultiProperty extends AbstractMultiNumericProperty<Double[]> {
18
19 public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory<DoubleMultiProperty>(Double[].class, numberFieldTypesByKey) {
20
21 public DoubleMultiProperty createWith(Map<String, String> valuesById) {
22 final String[] minMax = minMaxFrom(valuesById);
23 Double[] defaultValues = doublesIn(defaultValueIn(valuesById));
24 return new DoubleMultiProperty(
25 nameIn(valuesById),
26 descriptionIn(valuesById),
27 Double.parseDouble(minMax[0]),
28 Double.parseDouble(minMax[1]),
29 defaultValues,
30 0f
31 );
32 };
33 };
34
35
36
37
38
39
40
41
42
43
44 public DoubleMultiProperty(String theName, String theDescription, Double min, Double max, Double[] defaultValues, float theUIOrder) {
45 super(theName, theDescription, min, max, defaultValues, theUIOrder);
46 }
47
48
49
50
51
52 public Class<Double[]> type() {
53 return Double[].class;
54 }
55
56
57
58
59
60 protected Object createFrom(String value) {
61 return Double.valueOf(value);
62 }
63
64
65
66
67
68 protected Object[] arrayFor(int size) {
69 return new Double[size];
70 }
71 }