
org.jnosql.artemis.graph.GraphConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graph-extension Show documentation
Show all versions of graph-extension Show documentation
Eclipse JNoSQL mapping layer, Artemis, to Graph API
The newest version!
/*
* Copyright (c) 2017 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
*/
package org.jnosql.artemis.graph;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.List;
public interface GraphConverter {
/**
* Converts entity object to TinkerPop Vertex
*
* @param entity the entity
* @param the entity type
* @return the ThinkerPop Vertex with the entity values
* @throws NullPointerException when entity is null
*/
Vertex toVertex(T entity);
/**
* Converts vertex to an entity
*
* @param vertex the vertex
* @param the entity type
* @return a entity instance
* @throws NullPointerException when vertex is null
*/
T toEntity(Vertex vertex);
/**
* Converts vertex to an entity
*
* @param entityClass the entity class
* @param vertex the vertex
* @param the entity type
* @return a entity instance
* @throws NullPointerException when vertex or entityClass is null
*/
T toEntity(Class entityClass, Vertex vertex);
/**
*List the fields in the entity as property exclude fields annotated with {@link org.jnosql.artemis.Id}
* @param entity the entity
* @param the entity type
* @throws NullPointerException when entity is null
*/
List> getProperties(T entity);
/**
* Converts vertex to an entity
* Instead of creating a new object is uses the instance used in this parameters
*
* @param entityInstance the entity class
* @param vertex the vertex
* @param the entity type
* @return a entity instance
* @throws NullPointerException when vertex or entityInstance is null
*/
T toEntity(T entityInstance, Vertex vertex);
/**
* Converts {@link EdgeEntity} from {@link Edge} Thinkerpop
*
* @param edge the ThinkerPop edge
* @return an EdgeEntity instance
* @throws NullPointerException when Edge is null
*/
EdgeEntity toEdgeEntity(Edge edge);
/**
* Converts {@link Edge} from {@link EdgeEntity}
*
* @param edge the EdgeEntity instance
* @return a Edge instance
* @throws NullPointerException when edge entity is null
*/
Edge toEdge(EdgeEntity edge);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy