overflowdb.NodeFactory Maven / Gradle / Ivy
package overflowdb;
public abstract class NodeFactory {
public abstract String forLabel();
public abstract V createNode(NodeRef ref);
public abstract NodeRef createNodeRef(Graph graph, long id);
public V createNode(Graph graph, long id) {
final NodeRef ref = createNodeRef(graph, id);
final V node = createNode(ref);
node.markAsDirty(); //freshly created, i.e. not yet serialized
ref.setNode(node);
return node;
}
public DetachedNodeData createDetached(){
return new DetachedNodeGeneric(forLabel());
}
}