1 /** 2 * Copyright 2005-2013 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.Map; 20 import java.util.Set; 21 22 /** 23 * Map implementation takes a <code>Set</code> of Strings and converts to Map 24 * where the string is the map key and value is the Boolean true, convenience 25 * collection for expression language 26 * 27 * @author Kuali Rice Team (rice.collab@kuali.org) 28 */ 29 public class BooleanMap extends HashMap<String, Boolean> { 30 private static final long serialVersionUID = 4042557657401395547L; 31 32 public BooleanMap(Map<? extends String, ? extends Boolean> m) { 33 super(m); 34 } 35 36 public BooleanMap(Set<String> keys) { 37 super(); 38 39 for (String key : keys) { 40 this.put(key, Boolean.TRUE); 41 } 42 } 43 44 /** 45 * Overrides the get method to return Boolean false if the key does not 46 * exist in the Map 47 * 48 * @see java.util.HashMap#get(java.lang.Object) 49 */ 50 @Override 51 public Boolean get(Object key) { 52 if (super.containsKey(key)) { 53 return super.get(key); 54 } 55 56 return Boolean.FALSE; 57 } 58 59 }