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 * Defines a datatype that supports the single Long property values within an upper and lower boundary.
08 *
09 * @author Brian Remedios
10 */
11 public class LongProperty extends AbstractNumericProperty<Long> {
12
13 /**
14 * Constructor for LongProperty.
15 * @param theName String
16 * @param theDescription String
17 * @param min Long
18 * @param max Long
19 * @param theDefault Long
20 * @param theUIOrder float
21 * @throws IllegalArgumentException
22 */
23 public LongProperty(String theName, String theDescription, Long min, Long max, Long theDefault, float theUIOrder) {
24 super(theName, theDescription, min, max, theDefault, theUIOrder);
25 }
26
27 /**
28 * Constructor for LongProperty that limits itself to a single value within the specified limits.
29 * Converts string arguments into the Long values.
30 *
31 * @param theName String
32 * @param theDescription String
33 * @param minStr String
34 * @param maxStr String
35 * @param defaultStr String
36 * @param theUIOrder float
37 * @throws IllegalArgumentException
38 */
39 public LongProperty(String theName, String theDescription, String minStr, String maxStr, String defaultStr, float theUIOrder) {
40 this(theName, theDescription, longFrom(minStr), longFrom(maxStr), longFrom(defaultStr), theUIOrder);
41 }
42
43 /**
44 * @param numberString String
45 * @return Long
46 */
47 public static Long longFrom(String numberString) {
48 return Long.valueOf(numberString);
49 }
50
51 /**
52 * @return Class
53 * @see net.sourceforge.pmd.PropertyDescriptor#type()
54 */
55 public Class<Long> type() {
56 return Long.class;
57 }
58
59 /**
60 * @param value String
61 * @return Object
62 */
63 protected Object createFrom(String value) {
64 return longFrom(value);
65 }
66 }
|