Top Description Fields Constructors Methods
com.oracle.bmc.paginator.internal

public Class ResponseRecordIterator<REQUESTBUILDER, REQUEST, RESPONSE, ITEMTYPE>

extends AbstractResponseIterator<REQUESTBUILDER, REQUEST, RESPONSE>
implements Iterator<ITEMTYPE>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Type Parameters
<REQUESTBUILDER>
the type of a builder which can produce requests for a list operation
<REQUEST>
the type of a request to a list operation. This type must match the type produced by REQUESTBUILDER
<RESPONSE>
the type of the response from a list operation
<ITEMTYPE>
the type of the model/resource returned inside the response
Imports
java.util.Iterator, .List, .NoSuchElementException, java.util.function.Function

An iterator for iterating over response objects returned from a list operation. This iterator handles calling the service for additional data when needed. However, not every advancement of the iterator (via its next() method) will result in a method call. Instead, the logic of this iterator can be described as:
  1. Fetch a page of results from the service
  2. next() will vend individual model/resource objects from that page until there are no more to vend
  3. Call the service for the next page of results
  4. Repeat steps 2 and 3 until there are no more results
      This iterator does not support removal of elements.

Field Summary

Modifier and TypeField and Description
private List<ITEMTYPE>
private Iterator<ITEMTYPE>
private final Function<RESPONSE, List<ITEMTYPE>>
Inherited from com.oracle.bmc.paginator.internal.AbstractResponseIterator:
currentResponsenextPageTokennextPageTokenRetrievalFunctionpageRetrievalFunctionrequestBuilderrequestBuilderFunction

Constructor Summary

AccessConstructor and Description
public
ResponseRecordIterator(final REQUESTBUILDER
a builder object which can create requests for a list operation
requestBuilder
,
final Function<RESPONSE, String>
a function which can extract the next page token from a response produced by a list operation
nextPageTokenRetrievalFunction
,
final Function<RequestBuilderAndToken<REQUESTBUILDER>, REQUEST>
a function which can build a request for a list operation based on a builder object and a pagination token to use
requestBuilderFunction
,
final Function<REQUEST, RESPONSE>
a function which will call a list operation with a request and return the response of the call
pageRetrievalFunction
,
final Function<RESPONSE, List<ITEMTYPE>>
a function which can extract the collection of results from a response produced by a list operation
retrieveItemsFromResponseFunction
)

Constructs a new ResponseRecordIterator.

Method Summary

Modifier and TypeMethod and Description
private void
private void
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public ITEMTYPE
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from com.oracle.bmc.paginator.internal.AbstractResponseIterator:
fetchNextPagegetNextPageTokengetNextRequest

Field Detail

currentItemsback to summary
private List<ITEMTYPE> currentItems
currentIteratorback to summary
private Iterator<ITEMTYPE> currentIterator
retrieveItemsFromResponseFunctionback to summary
private final Function<RESPONSE, List<ITEMTYPE>> retrieveItemsFromResponseFunction

Constructor Detail

ResponseRecordIteratorback to summary
public ResponseRecordIterator(final REQUESTBUILDER requestBuilder, final Function<RESPONSE, String> nextPageTokenRetrievalFunction, final Function<RequestBuilderAndToken<REQUESTBUILDER>, REQUEST> requestBuilderFunction, final Function<REQUEST, RESPONSE> pageRetrievalFunction, final Function<RESPONSE, List<ITEMTYPE>> retrieveItemsFromResponseFunction)

Constructs a new ResponseRecordIterator.

Parameters
requestBuilder:REQUESTBUILDER

a builder object which can create requests for a list operation

nextPageTokenRetrievalFunction:Function<RESPONSE, String>

a function which can extract the next page token from a response produced by a list operation

requestBuilderFunction:Function<RequestBuilderAndToken<REQUESTBUILDER>, REQUEST>

a function which can build a request for a list operation based on a builder object and a pagination token to use

pageRetrievalFunction:Function<REQUEST, RESPONSE>

a function which will call a list operation with a request and return the response of the call

retrieveItemsFromResponseFunction:Function<RESPONSE, List<ITEMTYPE>>

a function which can extract the collection of results from a response produced by a list operation

Method Detail

getFirstPageback to summary
private void getFirstPage()
getNextPageback to summary
private void getNextPage()
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public ITEMTYPE next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:ITEMTYPE

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override