---
sourceDocument: Référence API Brésil
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/api-reference

 Release :

    - brazil

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence API Brésil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Classe du paginateur : Android

# Classe du paginateur : Android {#ariaid-title1}

Rversion finale: Brazil  
Mis à jour 10 sept. 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes de lecture  
La classe Paginator fournit des fonctions de pagination dans les résultats renvoyés par un appel de point de terminaison REST, tels que ceux renvoyés par la classe NowTableService .

Vous devez d'abord appeler la fonction ou [NowTableService : paginateur\<Modèle : décodable\>(from tableName : chaîne, chemin : chaîne = constants.resultPath, codeur : codeur = .default, configuration : FetchConfiguration ? = nil)](https://servicenow-prod.fluidtopics.net/RCMNq2o4jB6ZQTraODvKSA#NTblServ-paginator_S_S_S_O "Crée un paginateur qui active l’itération de pages de modèles décodés qui gèrent l’imbrication.") pour récupérer les [NowTableService : paginator(from tableName : String, configuration : FetchConfiguration ? = nil)](https://servicenow-prod.fluidtopics.net/RCMNq2o4jB6ZQTraODvKSA#NTblServ-paginator_S_O "Crée un paginateur qui permet d’itérer sur des pages d’enregistrements.") résultats de retour de pagination.

## Paginateur : first() {#ariaid-title2}

Récupère la première page des résultats de retour.
La méthode lève une `PaginationError` si elle ne peut pas extraire la première page.
{#PaginatorAnd-first__table_fpc_bgv_kqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 1. Paramètres]

{#PaginatorAnd-first__table_fpc_bgv_kqb} {#PaginatorAnd-first__table_gpc_bgv_kqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 2. Renvoie]

{#PaginatorAnd-first__table_gpc_bgv_kqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      paginator.first()
    }

## Paginateur : hasNext() {#ariaid-title3}

Vérifie s'il existe une page suivante dans les résultats de retour.
{#PaginatorAnd-hasNext__table_fxz_rww_rqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 3. Paramètres]

{#PaginatorAnd-hasNext__table_fxz_rww_rqb} {#PaginatorAnd-hasNext__table_gxz_rww_rqb__entry__2}

| Type | Description |
|-|-|
| Booléen | Marqueur indiquant s'il existe une page suivante dans les résultats de retour. Valeurs possibles : * true : prochaine page disponible. * faux : aucune page suivante disponible. |
[Tableau 4. Renvoie]

{#PaginatorAnd-hasNext__table_gxz_rww_rqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      if (paginator.hasNext() && !paginator.isBusy()) {
        paginator.next()
      }
    }

## Paginateur : hasPrevious() {#ariaid-title4}

Vérifie s'il y a une page précédente dans les résultats de retour.
{#PaginatorAnd-hasPrevious__table_qy4_dxw_rqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 5. Paramètres]

{#PaginatorAnd-hasPrevious__table_qy4_dxw_rqb} {#PaginatorAnd-hasPrevious__table_ry4_dxw_rqb__entry__2}

| Type | Description |
|-|-|
| Booléen | Marqueur indiquant s'il existe une page précédente dans les résultats de retour. Valeurs possibles : * true : page précédente disponible. * faux : aucune page précédente disponible. |
[Tableau 6. Renvoie]

{#PaginatorAnd-hasPrevious__table_ry4_dxw_rqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      if (paginator.hasPrevious() && !paginator.isBusy()) {
        paginator.previous()
      }
    }

## Paginateur : isBusy() {#ariaid-title5}

Vérifie si le paginateur est occupé à extraire des données.
{#PaginatorAnd-isBusy__table_w3d_cyw_rqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 7. Paramètres]

{#PaginatorAnd-isBusy__table_w3d_cyw_rqb} {#PaginatorAnd-isBusy__table_x3d_cyw_rqb__entry__2}

| Type | Description |
|-|-|
| Aucune | Marqueur indiquant si le paginateur est occupé à extraire des données. Valeurs possibles : * vrai : occupé à extraire les données. * faux : Pas occupé. |
[Tableau 8. Renvoie]

{#PaginatorAnd-isBusy__table_x3d_cyw_rqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      if (paginator.hasNext() && !paginator.isBusy()) {
        paginator.next()
      }
    }

## Paginateur : last() {#ariaid-title6}

Récupère la dernière page des résultats de retour.
La méthode lève une `PaginationError` si elle ne peut pas récupérer la dernière page.
{#PaginatorAnd-last__table_ipy_hgv_kqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 9. Paramètres]

{#PaginatorAnd-last__table_ipy_hgv_kqb} {#PaginatorAnd-last__table_jpy_hgv_kqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 10. Renvoie]

{#PaginatorAnd-last__table_jpy_hgv_kqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      if !paginator.isBusy()) {
        paginator.last()
      }
    }

## Paginateur : next() {#ariaid-title7}

Récupère la page suivante des résultats de retour.
La méthode génère une `PaginationError` s'il n'y a plus de pages à extraire.
{#PaginatorAnd-next__table_kj5_5cv_kqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 11. Paramètres]

{#PaginatorAnd-next__table_kj5_5cv_kqb} {#PaginatorAnd-next__table_lj5_5cv_kqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 12. Renvoie]

{#PaginatorAnd-next__table_lj5_5cv_kqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      if (paginator.hasNext() && !paginator.isBusy()) {
        paginator.next()
      }
    }

## Paginateur : observe(callback : PaginatorCallBack\<T\>) {#ariaid-title8}

Définit les rappels de l'objet Paginator. Vous devez appeler cette méthode avant d'appeler toute autre fonction Paginator.
{#PaginatorAnd-observe_O__table_yj5_yyw_rqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| rappel | PaginatorCallBack | Rappels à appeler en fonction de la réussite ou de l'échec de la création du paginateur. * Réussite : `plaisir abstrait onSuccess(response : Response<List<T>>)` * Échec : `plaisir abstrait onFailure(e : NowDataError)` |
[Tableau 13. Paramètres]

{#PaginatorAnd-observe_O__table_yj5_yyw_rqb} {#PaginatorAnd-observe_O__table_zj5_yyw_rqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 14. Renvoie]

{#PaginatorAnd-observe_O__table_zj5_yyw_rqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginationCallBack = object : PaginatorCallBack<NowAttachmentMetadata> {
        override fun onFailure(e: NowDataError) {
          handleError(e)
        }

        override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
          handleResponse(response)
        }

      }

      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(paginationCallBack)
        ?: throw Exception("Response is null")
    }

## Paginateur : previous() {#ariaid-title9}

Récupère la page précédente des résultats de retour.
La méthode lève une `PaginationError` si elle ne peut pas récupérer la page précédente.
{#PaginatorAnd-previous__table_lby_sfv_kqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 15. Paramètres]

{#PaginatorAnd-previous__table_lby_sfv_kqb} {#PaginatorAnd-previous__table_mby_sfv_kqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 16. Renvoie]

{#PaginatorAnd-previous__table_mby_sfv_kqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      if (paginator.hasPrevious() && !paginator.isBusy()) {
        paginator.previous()
      }
    }

## Paginateur : reset() {#ariaid-title10}

Réinitialise le paginateur à la première page, mais ne renvoie pas la première page des résultats renvoyés.
{#PaginatorAnd-reset__table_u1y_mgv_kqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 17. Paramètres]

{#PaginatorAnd-reset__table_u1y_mgv_kqb} {#PaginatorAnd-reset__table_v1y_mgv_kqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 18. Renvoie]

{#PaginatorAnd-reset__table_v1y_mgv_kqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    suspend fun createAttachmentMetadataPaginator() {
      val paginator = nowServiceManager.getNowAttachmentService()?.attachmentMetadataPaginator(null, 10)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onFailure(e: NowDataError) {
            handleError(e)
          }

          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            handleResponse(response)
          }

        })
        ?: throw Exception("Response is null")

      paginator.reset()
    }


