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

graphql.relay.DefaultEdge Maven / Gradle / Ivy

The newest version!
package graphql.relay;

public class DefaultEdge implements Edge {

    public DefaultEdge(T node, ConnectionCursor cursor) {
        if (node == null) {
            throw new IllegalArgumentException("node cannot be null");
        }
        if (cursor == null) {
            throw new IllegalArgumentException("cursor cannot be null");
        }
        this.node = node;
        this.cursor = cursor;
    }

    /**
     * @deprecated prefer {@link #DefaultEdge(Object, ConnectionCursor)}
     */
    @Deprecated
    public DefaultEdge() {
    }

    private T node;
    private ConnectionCursor cursor;

    @Override
    public T getNode() {
        return node;
    }

    /**
     * @deprecated prefer {@link #DefaultEdge(Object, ConnectionCursor)} and avoid mutation.
     * @param  node node
     */
    @Deprecated
    public void setNode(T node) {
        this.node = node;
    }

    @Override
    public ConnectionCursor getCursor() {
        return cursor;
    }

    /**
     * @deprecated prefer {@link #DefaultEdge(Object, ConnectionCursor)} and avoid mutation.
     * @param cursor cursor
     */
    @Deprecated
    public void setCursor(ConnectionCursor cursor) {
        this.cursor = cursor;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("DefaultEdge{");
        sb.append("node=").append(node);
        sb.append(", cursor=").append(cursor);
        sb.append('}');
        return sb.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy