Coverage Report - org.kuali.rice.core.api.uif.MultiSelect
 
Classes in this File Line Coverage Branch Coverage Complexity
MultiSelect
0%
0/11
N/A
1.545
MultiSelect$1
N/A
N/A
1.545
MultiSelect$Builder
0%
0/16
0%
0/8
1.545
MultiSelect$Constants
0%
0/1
N/A
1.545
MultiSelect$Elements
0%
0/1
N/A
1.545
 
 1  
 package org.kuali.rice.core.api.uif;
 2  
 
 3  
 import javax.xml.bind.annotation.XmlAccessType;
 4  
 import javax.xml.bind.annotation.XmlAccessorType;
 5  
 import javax.xml.bind.annotation.XmlElement;
 6  
 import javax.xml.bind.annotation.XmlType;
 7  
 import java.util.Collections;
 8  
 import java.util.HashMap;
 9  
 import java.util.Map;
 10  
 
 11  
 @XmlAccessorType(XmlAccessType.NONE)
 12  
 @XmlType(name = MultiSelect.Constants.TYPE_NAME)
 13  0
 public class MultiSelect extends AbstractControl implements Sized, KeyLabeled {
 14  
 
 15  
     @XmlElement(name = Elements.SIZE, required = false)
 16  
     private final Integer size;
 17  
 
 18  
     @XmlElement(name = Elements.KEY_LABELS, required = false)
 19  
     private final Map<String, String> keyLabels;
 20  
 
 21  0
     private MultiSelect() {
 22  0
         size = null;
 23  0
         keyLabels = null;
 24  0
     }
 25  
 
 26  0
     private MultiSelect(Builder b) {
 27  0
         size = b.size;
 28  0
         keyLabels = b.keyLabels;
 29  0
     }
 30  
 
 31  
     @Override
 32  
     public Map<String, String> getKeyLabels() {
 33  0
         return keyLabels;
 34  
     }
 35  
 
 36  
     @Override
 37  
     public Integer getSize() {
 38  0
         return size;
 39  
     }
 40  
 
 41  0
     public static final class Builder extends AbstractControl.Builder implements Sized, KeyLabeled {
 42  
         private Integer size;
 43  
         private Map<String, String> keyLabels;
 44  
 
 45  0
         private Builder(Map<String, String> keyLabels) {
 46  0
             setKeyLabels(keyLabels);
 47  0
         }
 48  
 
 49  
         public static Builder create(Map<String, String> keyLabels) {
 50  0
             return new Builder(keyLabels);
 51  
         }
 52  
 
 53  
         @Override
 54  
         public Integer getSize() {
 55  0
             return size;
 56  
         }
 57  
 
 58  
         public void setSize(Integer size) {
 59  0
             if (size != null && size < 1) {
 60  0
                 throw new IllegalArgumentException("size was < 1");
 61  
             }
 62  
 
 63  0
             this.size = size;
 64  0
         }
 65  
 
 66  
         @Override
 67  
         public Map<String, String> getKeyLabels() {
 68  0
             return keyLabels;
 69  
         }
 70  
 
 71  
         public void setKeyLabels(Map<String, String> keyLabels) {
 72  0
             if (keyLabels == null || keyLabels.isEmpty()) {
 73  0
                 throw new IllegalArgumentException("keyLabels must be non-null & non-empty");
 74  
             }
 75  
 
 76  0
             this.keyLabels = Collections.unmodifiableMap(new HashMap<String, String>(keyLabels));
 77  0
         }
 78  
 
 79  
         @Override
 80  
         public MultiSelect build() {
 81  0
             return new MultiSelect(this);
 82  
         }
 83  
     }
 84  
 
 85  
     /**
 86  
      * Defines some internal constants used on this class.
 87  
      */
 88  0
     static final class Constants {
 89  
         static final String TYPE_NAME = "MultiSelectType";
 90  
     }
 91  
 
 92  0
     static final class Elements {
 93  
         static final String SIZE = "size";
 94  
         static final String KEY_LABELS = "keyLabels";
 95  
     }
 96  
 }