Trying to make my project independant of Edge and Nodetype I am using as much generics as possible, however when instantiating a new Graph in order to provide an edgetype I followed this: How to get a class instance of generics type T
Problem I get an error:
Exception in thread "main" java.lang.RuntimeException: Supplier failed at org.jgrapht.util.SupplierUtil.lambda$createSupplier$32fc57c8$1(SupplierUtil.java:64) at org.jgrapht.graph.AbstractBaseGraph.addEdge(AbstractBaseGraph.java:246) at perspective.StructureMap.investigateGraph(StructureMap.java:54)
StructureData<V, E> struc=new StructureData<V, E>(cls);
struc.g.addEdge(knot,nachb);
public class StructureData<V, E> {
private Class<E> cls;
public StructureData(Class<E> cls)
{
this.cls=cls;
}
//public SimpleDirectedGraph<Object,Edge> g= new SimpleDirectedGraph<Object,Edge>(Edge.class);
public SimpleDirectedGraph<Object,E> g= new SimpleDirectedGraph<Object,E>(cls);
public Map<V,V> excluded= new HashMap<V,V>();
public Set<PlaceholderNode> substitutes=new HashSet<PlaceholderNode>();
public HashMap<Object,Integer> generation=new HashMap<Object,Integer>();
public HashMap<Object,Integer> branch=new HashMap<Object,Integer>();
public HashMap<Object,Object> previous=new HashMap<Object,Object>();
}