1 16 17 package org.apache.commons.configuration; 18 19 import java.util.Iterator ; 20 import java.util.List ; 21 import java.util.Map ; 22 23 30 public class MapConfiguration extends AbstractConfiguration 31 { 32 33 protected Map map; 34 35 42 public MapConfiguration(Map map) 43 { 44 this.map = map; 45 } 46 47 50 public Map getMap() 51 { 52 return map; 53 } 54 55 public Object getProperty(String key) 56 { 57 Object value = map.get(key); 58 if (value instanceof String ) 59 { 60 List list = PropertyConverter.split((String ) value, getDelimiter()); 61 return list.size() > 1 ? list : value; 62 } 63 else 64 { 65 return value; 66 } 67 } 68 69 protected void addPropertyDirect(String key, Object obj) 70 { 71 map.put(key, obj); 72 } 73 74 public boolean isEmpty() 75 { 76 return map.isEmpty(); 77 } 78 79 public boolean containsKey(String key) 80 { 81 return map.containsKey(key); 82 } 83 84 public void clearProperty(String key) 85 { 86 map.remove(key); 87 } 88 89 public Iterator getKeys() 90 { 91 return map.keySet().iterator(); 92 } 93 } 94 | Popular Tags |