Java Code Examples for org.apache.tinkerpop.gremlin.structure.Element#getClass()

The following examples show how to use org.apache.tinkerpop.gremlin.structure.Element#getClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OndiskOverflow.java    From tinkergraph-gremlin with Apache License 2.0 5 votes vote down vote up
public void persist(final Element element) throws IOException {
  if (!closed) {
    final Long id = (Long) element.id();
    if (element instanceof Vertex) {
      vertexMVMap.put(id, vertexSerializer.serialize((Vertex) element));
    } else if (element instanceof Edge) {
      edgeMVMap.put(id, edgeSerializer.serialize((Edge) element));
    } else {
      throw new RuntimeException("unable to serialize " + element + " of type " + element.getClass());
    }
  }
}
 
Example 2
Source File: DetachedFactory.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public static DetachedElement detach(final Element element, final boolean withProperties) {
    if (element instanceof Vertex)
        return detach((Vertex) element, withProperties);
    else if (element instanceof Edge)
        return detach((Edge) element, withProperties);
    else if (element instanceof VertexProperty)
        return detach((VertexProperty) element, withProperties);
    else
        throw new IllegalArgumentException("The provided argument is an unknown element: " + element + ':' + element.getClass());
}
 
Example 3
Source File: ReferenceFactory.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public static ReferenceElement detach(final Element element) {
    if (element instanceof Vertex)
        return detach((Vertex) element);
    else if (element instanceof Edge)
        return detach((Edge) element);
    else if (element instanceof VertexProperty)
        return detach((VertexProperty) element);
    else
        throw new IllegalArgumentException("The provided argument is an unknown element: " + element + ':' + element.getClass());
}