# PaginationResult

@Serializable
data class PaginationResult < T >(val page: Int , val size: Int , val results: List < T >, val objectsNumber: Long ) : Pagination (source)

#### Parameters

page

Current page number

size

Current page size. It can be greater than size of results

results

Result objects

objectsNumber

Count of all objects across all pages

## Constructors

PaginationResult
Link copied to clipboard
constructor(page: Int , size: Int , results: List < T >, objectsNumber: Long )
constructor(page: Int , results: List < T >, pagesNumber: Int , size: Int = results.size)

## Properties

asUrlQueryArrayParts
Link copied to clipboard
val Pagination . asUrlQueryArrayParts : Array < Pair < String , String >>
asUrlQueryParts
Link copied to clipboard
val Pagination . asUrlQueryParts : Map < String , String >
endInclusive
Link copied to clipboard
open override val endInclusive : Int
firstIndex
Link copied to clipboard
val Pagination . firstIndex : Int

First number in index of objects. It can be used as offset for databases or other data sources

isFirstPage
Link copied to clipboard
val Pagination . isFirstPage : Boolean

Logical shortcut for comparison that page is 0

isLastPage
Link copied to clipboard
val PaginationResult <*>. isLastPage : Boolean
lastIndex
Link copied to clipboard
val Pagination . lastIndex : Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastIndexExclusive
Link copied to clipboard
val Pagination . lastIndexExclusive : Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastPage
Link copied to clipboard
val PaginationResult <*>. lastPage : Int
lastPageLong
Link copied to clipboard
val PaginationResult <*>. lastPageLong : Long
objectsNumber
Link copied to clipboard
val objectsNumber : Long
page
Link copied to clipboard
open override val page : Int
pagesNumber
Link copied to clipboard
@Transient
val pagesNumber : Int

Amount of pages for current pagination

pagesNumberLong
Link copied to clipboard
@EncodeDefault
@SerialName(value = "pagesNumber")
val pagesNumberLong : Long

Amount of pages for current pagination

results
Link copied to clipboard
val results : List < T >
size
Link copied to clipboard
open override val size : Int
start
Link copied to clipboard
open override val start : Int

## Functions

changeResults
Link copied to clipboard
inline fun < I , O > PaginationResult < I >. changeResults (block: PaginationResult < I >.() -> List < O >): PaginationResult < O >
fun < I , O > PaginationResult < I >. changeResults (data: List < O >): PaginationResult < O >
changeResultsUnchecked
Link copied to clipboard
inline fun < I , O > PaginationResult < I >. changeResultsUnchecked (block: PaginationResult < I >.() -> List < O >): PaginationResult < O >
fun < I , O > PaginationResult < I >. changeResultsUnchecked (data: List < O >): PaginationResult < O >
contains
Link copied to clipboard
open operator fun contains (value: Int ): Boolean
currentPageIfNotEmpty
Link copied to clipboard
fun < T > PaginationResult < T >. currentPageIfNotEmpty (): PaginationResult < T >?
currentPageIfNotEmptyOrLastPage
Link copied to clipboard
fun < T > PaginationResult < T >. currentPageIfNotEmptyOrLastPage (): PaginationResult < T >?
currentPageIfNotLastPage
Link copied to clipboard
fun < T > PaginationResult < T >. currentPageIfNotLastPage (): PaginationResult < T >?
firstPage
Link copied to clipboard
fun Pagination . firstPage (): Pagination
intersect
Link copied to clipboard
fun < T : Comparable < T >> ClosedRange < T >. intersect (other: ClosedRange < T >): Pair < T , T >?

Computes the intersection of this range with other. Returns a pair representing the intersecting range, or null if the ranges don't overlap.

fun Pagination . intersect (other: Pagination ): Pagination ?
isEmpty
Link copied to clipboard
open fun isEmpty (): Boolean
limitClause
Link copied to clipboard
fun Pagination . limitClause (): String
nextPage
Link copied to clipboard
inline fun Pagination . nextPage (): SimplePagination
nextPageIfNotEmpty
Link copied to clipboard
fun PaginationResult <*>. nextPageIfNotEmpty (): SimplePagination ?
nextPageIfNotEmptyOrLastPage
Link copied to clipboard
fun PaginationResult <*>. nextPageIfNotEmptyOrLastPage (): SimplePagination ?
nextPageIfNotLastPage
Link copied to clipboard
fun PaginationResult <*>. nextPageIfNotLastPage (): SimplePagination ?
optionallyReverse
Link copied to clipboard
fun Pagination . optionallyReverse (objectsCount: Int , reverse: Boolean ): Pagination
fun Pagination . optionallyReverse (objectsCount: Long , reverse: Boolean ): Pagination
previousPage
Link copied to clipboard
inline fun Pagination . previousPage (): SimplePagination

This method DO NOT check Pagination.page of receiver. Returns pagination for previous page

reverse
Link copied to clipboard
fun Pagination . reverse (objectsCount: Int ): SimplePagination

Shortcut for reverse

fun Pagination . reverse (datasetSize: Long ): SimplePagination

Example:

thisPageIfNotEmpty
Link copied to clipboard
fun < T > PaginationResult < T >. thisPageIfNotEmpty (): PaginationResult < T >?
thisPageIfNotEmptyOrLastPage
Link copied to clipboard
fun < T > PaginationResult < T >. thisPageIfNotEmptyOrLastPage (): PaginationResult < T >?
thisPageIfNotLastPage
Link copied to clipboard
fun < T > PaginationResult < T >. thisPageIfNotLastPage (): PaginationResult < T >?