1 package com.thoughtworks.xstream.core; 2 3 import com.thoughtworks.xstream.converters.DataHolder; 4 5 import java.util.Collections ; 6 import java.util.HashMap ; 7 import java.util.Iterator ; 8 import java.util.Map ; 9 10 public class MapBackedDataHolder implements DataHolder { 11 private final Map map; 12 13 public MapBackedDataHolder() { 14 this(new HashMap ()); 15 } 16 17 public MapBackedDataHolder(Map map) { 18 this.map = map; 19 } 20 21 public Object get(Object key) { 22 return map.get(key); 23 } 24 25 public void put(Object key, Object value) { 26 map.put(key, value); 27 } 28 29 public Iterator keys() { 30 return Collections.unmodifiableCollection(map.keySet()).iterator(); 31 } 32 } 33 | Popular Tags |