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

com.bronto.api.request.AsyncReadPager Maven / Gradle / Ivy

The newest version!
package com.bronto.api.request;

import com.bronto.api.AsyncVoidHandler;
import com.bronto.api.ObjectOperationsAsync;

import java.util.List;

public abstract class AsyncReadPager extends AsyncVoidHandler> {
    private final ObjectOperationsAsync ops;
    private final BrontoReadRequest read;

    public AsyncReadPager(ObjectOperationsAsync ops, BrontoReadRequest read) {
        this.ops = ops;
        this.read = read;
    }

    public ObjectOperationsAsync getOperations() {
        return ops;
    }

    public BrontoReadRequest getRequest() {
        return read;
    }

    @Override
    public void onComplete(List objects) {
        while (!objects.isEmpty()) {
            readObjects(objects);
            try {
                objects = ops.read(read.next()).get();
            } catch (Exception e) {
                onError(e);
            }
        }
    }

    public abstract void readObjects(List objects);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy