| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BooleanMap |
|
| 2.5;2.5 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.krad.uif.util; | |
| 17 | ||
| 18 | import java.util.HashMap; | |
| 19 | import java.util.Set; | |
| 20 | ||
| 21 | /** | |
| 22 | * Map implementation takes a <code>Set</code> of Strings and converts to Map | |
| 23 | * where the string is the map key and value is the Boolean true, convenience | |
| 24 | * collection for expression language | |
| 25 | * | |
| 26 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 27 | */ | |
| 28 | 0 | public class BooleanMap extends HashMap<String, Boolean> { |
| 29 | private static final long serialVersionUID = 4042557657401395547L; | |
| 30 | ||
| 31 | public BooleanMap(Set<String> keys) { | |
| 32 | 0 | super(); |
| 33 | ||
| 34 | 0 | for (String key : keys) { |
| 35 | 0 | this.put(key, Boolean.TRUE); |
| 36 | } | |
| 37 | 0 | } |
| 38 | ||
| 39 | /** | |
| 40 | * Overrides the get method to return Boolean false if the key does not | |
| 41 | * exist in the Map | |
| 42 | * | |
| 43 | * @see java.util.HashMap#get(java.lang.Object) | |
| 44 | */ | |
| 45 | @Override | |
| 46 | public Boolean get(Object key) { | |
| 47 | 0 | if (super.containsKey(key)) { |
| 48 | 0 | return super.get(key); |
| 49 | } | |
| 50 | ||
| 51 | 0 | return Boolean.FALSE; |
| 52 | } | |
| 53 | ||
| 54 | } |