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