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

com.tinkerpop.blueprints.impls.neo4jbatch.Neo4jBatchElement Maven / Gradle / Ivy

The newest version!
package com.tinkerpop.blueprints.impls.neo4jbatch;

import com.tinkerpop.blueprints.Element;
import com.tinkerpop.blueprints.util.ElementHelper;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
abstract class Neo4jBatchElement implements Element {

    protected final Neo4jBatchGraph graph;
    protected final Long id;

    protected Neo4jBatchElement(final Neo4jBatchGraph graph, final Long id) {
        this.graph = graph;
        this.id = id;
    }

    public Object getId() {
        return id;
    }

    public abstract Map getPropertyMap();

    public Set getPropertyKeys() {
        return this.getPropertyMap().keySet();
    }

    public Object getProperty(final String key) {
        return this.getPropertyMap().get(key);
    }

    protected Map getPropertyMapClone() {
        final Map clone = new HashMap();
        for (Map.Entry entry : this.getPropertyMap().entrySet()) {
            clone.put(entry.getKey(), entry.getValue());
        }
        return clone;

    }

    public int hashCode() {
        return this.getId().hashCode();
    }

    public boolean equals(final Object object) {
        return ElementHelper.areEqual(this, object);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy