All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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) {
    return createNode(graph, id, null);
  }

  public V createNode(Graph graph, long id, NodeRef ref) {
    if(ref == null) 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());
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy