001    /*
002    @license.text@
003     */
004    package biz.hammurapi.config;
005    
006    import java.util.Iterator;
007    import java.util.Map;
008    
009    /**
010     * @author Pavel Vlasov
011     * @version $Revision: 1.1 $
012     */
013    public class MapContext implements ContextEx {
014    
015            private Map map;
016            private Context parent;
017    
018            public Object get(String name) {
019                    Object ret = map.get(name);
020                    return ret==null && parent!=null ? parent.get(name) : ret;
021            }
022    
023            public MapContext(Map map) {
024                    this.map=map;
025            }
026    
027            public MapContext(Map map, Context parent) {
028                    this.map=map;
029                    this.parent=parent;
030            }
031    
032            public Iterator getNames() {
033                    return map.keySet().iterator();
034            }
035    }