com.thoughtworks.xstream.core.MapBackedDataHolder Maven / Gradle / Ivy
/*
* Copyright (C) 2004 Joe Walnes.
* Copyright (C) 2006, 2007 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
* Created on 04. October 2004 by Joe Walnes
*/
package com.thoughtworks.xstream.core;
import com.thoughtworks.xstream.converters.DataHolder;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@SuppressWarnings({"rawtypes", "unchecked"})
public class MapBackedDataHolder implements DataHolder {
private final Map map;
public MapBackedDataHolder() {
this(new HashMap());
}
public MapBackedDataHolder(Map map) {
this.map = map;
}
public Object get(Object key) {
return map.get(key);
}
public void put(Object key, Object value) {
map.put(key, value);
}
public Iterator keys() {
return Collections.unmodifiableCollection(map.keySet()).iterator();
}
}