net.razorvine.pickle.objects.ClassDict Maven / Gradle / Ivy
package net.razorvine.pickle.objects;
import java.util.HashMap;
import java.util.Map;
///
/// A dictionary containing just the fields of the class.
///
public class ClassDict extends HashMap
{
private static final long serialVersionUID = 576056580143549390L;
private String classname;
public ClassDict(String modulename, String classname)
{
if(modulename==null)
this.classname = classname;
else
this.classname = modulename+"."+classname;
}
///
/// for the unpickler to restore state
///
public void __setstate__(HashMap values) {
this.clear();
this.put("__class__", this.classname);
for(Map.Entry e: values.entrySet())
{
this.put(e.getKey(), e.getValue());
}
}
}