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

org.eclipse.jnosql.mapping.graph.EdgeEntity Maven / Gradle / Ivy

There is a newer version: 1.1.3
Show newest version
/*
 *  Copyright (c) 2022 Contributors to the Eclipse Foundation
 *   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.eclipse.jnosql.mapping.graph;

import org.eclipse.jnosql.communication.Value;
import org.apache.tinkerpop.gremlin.structure.Property;

import java.util.List;
import java.util.Optional;

/**
 * It is a wrapper of {@link org.apache.tinkerpop.gremlin.structure.Edge} that links two Entity.
 * Along with its Property objects, an Edge has both a Direction and a label.
 * Any Change at the Edge is automatically continued in the database. However, any, change in the Entity will be ignored.
 * {@link GraphTemplate#update(Object)}
 *
 * 
outVertex ---label---> inVertex.
*/ public interface EdgeEntity { /** * Returns the id * * @return the id */ Object id(); /** * Returns an id from {@link org.eclipse.jnosql.communication.Value#get(Class)} * * @param type the class type * @param the type * @return an id converted */ T id(Class type); /** * Returns the label of the vertex * * @return the label */ String label(); /** * Gets the incoming entity * * @param the type * @return the incoming entity */ T incoming(); /** * Gets the outgoing entity * * @param the type * @return the outgoing entity */ T outgoing(); /** * Returns the properties of this vertex * * @return the properties */ List properties(); /** * Add a new element in the Vertex * * @param key the key * @param value the information * @throws NullPointerException when either key or value are null */ void add(String key, Object value); /** * Add a new element in the Vertex * * @param key the key * @param value the information * @throws NullPointerException when either key or value are null */ void add(String key, Value value); /** * Removes an property * * @param key the key * @throws NullPointerException whe key is null */ void remove(String key); /** * Returns the property from the key * * @param key the key to find the property * @return the property to the respective key otherwise {@link Optional#empty()} * @throws NullPointerException when key is null */ Optional get(String key); /** * Returns true if this Edge contains no elements. * * @return true if this collection contains no elements */ boolean isEmpty(); /** * Returns the number of property in Edge * * @return the number of elements in this Edge */ int size(); /** * Deletes the Edge from the database, after this operation, any write operation * such as add a property will an illegal state. */ void delete(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy