com.microsoft.bingads.v13.internal.bulk.ExtractChildEntitiesIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft.bingads Show documentation
Show all versions of microsoft.bingads Show documentation
The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.
package com.microsoft.bingads.v13.internal.bulk;
import java.util.Iterator;
import com.microsoft.bingads.v13.bulk.entities.BulkEntity;
public class ExtractChildEntitiesIterator implements Iterator {
private Iterator extends BulkEntity> children;
private Iterator currentChildIterator;
public ExtractChildEntitiesIterator(Iterator extends BulkEntity> children) {
this.children = children;
}
@Override
public boolean hasNext() {
this.update();
if (this.currentChildIterator == null) {
return false;
}
return this.currentChildIterator.hasNext() ? true : this.hasNext();
}
@Override
public BulkEntity next() {
this.update();
if (this.currentChildIterator.hasNext()) {
return this.currentChildIterator.next();
}
throw new UnsupportedOperationException();
}
public void update() {
if (currentChildIterator == null || !currentChildIterator.hasNext()) {
if (children.hasNext()) {
BulkEntity nextChild = children.next();
currentChildIterator = EntityExtractor.extractChildEntitiesIfNeeded(nextChild);
} else {
currentChildIterator = null;
}
}
}
@Override
public void remove() {
throw new UnsupportedOperationException("Not supported yet.");
}
}