net.amygdalum.util.graph.DataDescriptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compilerutils Show documentation
Show all versions of compilerutils Show documentation
Utility classes needed for search and compiler applications
The newest version!
package net.amygdalum.util.graph;
import java.util.Map;
public class DataDescriptor {
private Class clazz;
private String key;
public DataDescriptor(Class clazz, String key) {
this.clazz = clazz;
this.key = key;
}
public T from(Map, Object> repo) {
return clazz.cast(repo.get(this));
}
public void to(Map, Object> repo, T data) {
repo.put(this, data);
}
@Override
public int hashCode() {
return clazz.hashCode() * 13 + key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
DataDescriptor> that = (DataDescriptor>) obj;
return this.clazz == that.clazz
&& this.key.equals(that.key);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy