FloatMultiProperty.java
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 property type that support float property values within an upper and lower boundary.
08  * 
09  * @author Brian Remedios
10  */
11 public class FloatMultiProperty extends AbstractMultiNumericProperty<Float[]> {
12   /**
13    * Constructor for FloatProperty that configures it to accept multiple values and any number of defaults.
14    * 
15    * @param theName String
16    * @param theDescription String
17    * @param min Float
18    * @param max Float
19    * @param defaultValues Float[]
20    * @param theUIOrder float
21    * @throws IllegalArgumentException
22    */
23   public FloatMultiProperty(String theName, String theDescription, Float min, Float max, Float[] defaultValues, float theUIOrder) {
24     super(theName, theDescription, min, max, defaultValues, theUIOrder);
25   }
26   
27   /**
28    * @return Class
29    * @see net.sourceforge.pmd.PropertyDescriptor#type()
30    */
31   public Class<Float[]> type() {
32     return Float[].class;
33   }
34   
35   /**
36    * Creates an property value of the right type from a raw string.
37    * 
38    * @param value String
39    * @return Object
40    */
41   protected Object createFrom(String value) {
42     return Float.valueOf(value);
43   }
44 
45   /**
46    * Returns an array of the correct type for the receiver.
47    * 
48    * @param size int
49    * @return Object[]
50    */
51   protected Object[] arrayFor(int size) {
52     return new Float[size];
53   }
54 }