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

com.box.sdk.BoxCollaborationIterator Maven / Gradle / Ivy

There is a newer version: 4.12.0
Show newest version
package com.box.sdk;

import static com.box.sdk.PagingParameters.offset;

import com.eclipsesource.json.JsonObject;
import java.net.URL;
import java.util.Iterator;

class BoxCollaborationIterator implements Iterator {
    private static final long LIMIT = 100;
    private final BoxAPIConnection api;
    private final JsonIterator jsonIterator;

    BoxCollaborationIterator(BoxAPIConnection api, URL url) {
        this.api = api;
        this.jsonIterator = new JsonIterator(api, url, offset(0, LIMIT));
    }

    @Override
    public boolean hasNext() {
        return this.jsonIterator.hasNext();
    }

    @Override
    public BoxCollaboration.Info next() {
        JsonObject nextJSONObject = this.jsonIterator.next();
        String id = nextJSONObject.get("id").asString();

        BoxCollaboration collaboration = new BoxCollaboration(this.api, id);
        return collaboration.new Info(nextJSONObject);
    }

    public void remove() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy