01 /**
02 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03 */
04 package net.sourceforge.pmd.lang.rule.properties;
05
06
07 /**
08 * Defines a property type that support single double-type property values within an upper and lower boundary.
09 *
10 * @author Brian Remedios
11 */
12 public class DoubleProperty extends AbstractNumericProperty<Double> {
13
14 /**
15 * Constructor for DoubleProperty.
16 * @param theName String
17 * @param theDescription String
18 * @param min double
19 * @param max double
20 * @param theDefault double
21 * @param theUIOrder float
22 * @throws IllegalArgumentException
23 */
24 public DoubleProperty(String theName, String theDescription, Double min, Double max, Double theDefault, float theUIOrder) {
25 super(theName, theDescription, min, max, theDefault, theUIOrder);
26 }
27
28 /**
29 * Constructor for DoubleProperty.
30 * @param theName String
31 * @param theDescription String
32 * @param minStr String
33 * @param maxStr String
34 * @param defaultStr String
35 * @param theUIOrder float
36 * @throws IllegalArgumentException
37 */
38 public DoubleProperty(String theName, String theDescription, String minStr, String maxStr, String defaultStr, float theUIOrder) {
39 this(theName, theDescription, doubleFrom(minStr), doubleFrom(maxStr), doubleFrom(defaultStr), theUIOrder);
40 }
41
42
43 /**
44 * @param numberString String
45 * @return Double
46 */
47 public static Double doubleFrom(String numberString) {
48 return Double.valueOf(numberString);
49 }
50
51 /**
52 * @return Class
53 * @see net.sourceforge.pmd.PropertyDescriptor#type()
54 */
55 public Class<Double> type() {
56 return Double.class;
57 }
58
59 /**
60 * Deserializes a string into its Double form.
61 *
62 * @param value String
63 * @return Object
64 */
65 protected Object createFrom(String value) {
66 return doubleFrom(value);
67 }
68 }
|