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

org.vertexium.query.DefaultGraphQueryIdIterable Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.query;

import org.vertexium.Element;
import org.vertexium.ExtendedDataRow;
import org.vertexium.VertexiumException;
import org.vertexium.VertexiumObject;
import org.vertexium.util.ConvertingIterable;

import java.io.IOException;

public class DefaultGraphQueryIdIterable extends ConvertingIterable implements QueryResultsIterable {

    private final QueryResultsIterable iterable;

    public DefaultGraphQueryIdIterable(QueryResultsIterable iterable) {
        super(iterable);
        this.iterable = iterable;
    }

    @SuppressWarnings("unchecked")
    @Override
    protected T convert(VertexiumObject vertexiumObject) {
        if (vertexiumObject instanceof Element) {
            return (T) ((Element) vertexiumObject).getId();
        } else if (vertexiumObject instanceof ExtendedDataRow) {
            return (T) ((ExtendedDataRow) vertexiumObject).getId();
        }
        throw new VertexiumException("Unsupported class: " + vertexiumObject.getClass().getName());
    }

    @Override
    public  TResult getAggregationResult(String name, Class resultType) {
        return iterable.getAggregationResult(name, resultType);
    }

    @Override
    public void close() throws IOException {
        iterable.close();
    }

    @Override
    public long getTotalHits() {
        return iterable.getTotalHits();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy