BooleanMultiProperty.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 supports multiple Boolean values.
08  
09  @author Brian Remedios
10  */
11 public class BooleanMultiProperty extends AbstractScalarProperty<Boolean[]{
12   /**
13    * Constructor for BooleanMultiProperty that allows for multiple values.
14    
15    @param theName String
16    @param theDescription String
17    @param defaultValues Boolean[]
18    @param theUIOrder float
19    */
20   public BooleanMultiProperty(String theName, String theDescription, Boolean[] defaultValues, float theUIOrder) {
21     super(theName, theDescription, defaultValues, theUIOrder);
22   }
23   
24   /**
25    @return Class
26    @see net.sourceforge.pmd.PropertyDescriptor#type()
27    */
28   public Class<Boolean[]> type() {
29     return Boolean[].class;
30   }
31 
32   /**
33    @return boolean
34    @see net.sourceforge.pmd.PropertyDescriptor#isMultiValue()
35    */
36   @Override
37   public boolean isMultiValue() {
38     return true;
39   }
40   
41   /**
42    * Creates and returns a Boolean instance from a raw string
43    
44    @param value String
45    @return Object
46    */
47   protected Object createFrom(String value) {
48     return Boolean.valueOf(value);
49   }
50 
51   /**
52    @param size int
53    @return Object[]
54    */
55   protected Boolean[] arrayFor(int size) {
56     return new Boolean[size];
57   }
58   
59     /**
60      @return String
61      */
62     protected String defaultAsString() {
63         return asDelimitedString(defaultValue());
64     }
65 }