Class Pagination<T>
java.lang.Object
dev.getelements.elements.sdk.model.Pagination<T>
- Type Parameters:
T- the element type
- All Implemented Interfaces:
Serializable,Iterable<T>
- Direct Known Subclasses:
AuthSchemePagination,DistinctInventoryItemPagination,ElementsSmartContractPagination,InventoryItemPagination,ItemLedgerEntryPagination,LargeObjectPagination,MetadataPagination,MetadataSpecPagination,MongoRankDao.MongoRankPagination,MultiMatchPagination,ProductBundlePagination,ProductSkuSchemaPagination,ProfilePagination,ProgressPagination,ReceiptPagination,SaveDataDocumentPagination,ScheduleEventPagination,SchedulePagination,SmartContractPagination,VaultPagination,WalletPagination
Represents a paginated result set with offset and total count.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Pagination<T> empty()Returns an empty pagination with no results.booleanstatic <U> Pagination<U> Creates a Pagination from a stream, collecting all elements.Returns the objects in this page.intReturns the current page offset.intgetTotal()Returns the total number of results.inthashCode()booleanReturns whether the total is an approximation.iterator()voidsetApproximation(boolean approximation) Sets whether the total is an approximation.voidsetObjects(List<T> objects) Sets the objects in this page.voidsetOffset(int offset) Sets the current page offset.voidsetTotal(int total) Sets the total number of results.stream()Returns a sequential stream of the objects in this page.<U> Pagination<U> Transforms this pagination by applying a function to each element.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Pagination
public Pagination()Creates a new instance.
-
-
Method Details
-
empty
Returns an empty pagination with no results.- Type Parameters:
T- the result type- Returns:
- an empty pagination
-
getOffset
public int getOffset()Returns the current page offset.- Returns:
- the offset
-
setOffset
public void setOffset(int offset) Sets the current page offset.- Parameters:
offset- the offset
-
getTotal
public int getTotal()Returns the total number of results.- Returns:
- the total count
-
setTotal
public void setTotal(int total) Sets the total number of results.- Parameters:
total- the total count
-
getObjects
Returns the objects in this page.- Returns:
- the objects
-
setObjects
Sets the objects in this page.- Parameters:
objects- the objects
-
isApproximation
public boolean isApproximation()Returns whether the total is an approximation.- Returns:
- true if the total is an approximation
-
setApproximation
public void setApproximation(boolean approximation) Sets whether the total is an approximation.- Parameters:
approximation- true if the total is an approximation
-
from
Creates a Pagination from a stream, collecting all elements.- Type Parameters:
U- the element type- Parameters:
uStream- the stream of elements- Returns:
- a Pagination containing all stream elements
-
transform
Transforms this pagination by applying a function to each element.- Type Parameters:
U- the target element type- Parameters:
function- the transformation function- Returns:
- a new Pagination with transformed elements
-
stream
Returns a sequential stream of the objects in this page.- Returns:
- a stream of objects
-
iterator
-
equals
-
hashCode
public int hashCode()
-