Interface PaginatedResult<R>

Type Parameters:
R - the item type

@InternalApi @Immutable public interface PaginatedResult<R>
A paginated result with an optional cursor for the next page.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    Returns true if the requested cursor was valid: either absent (first page) or found among the underlying items.
    default boolean
    Returns true if there are more items beyond this page.
    The items on this page.
    @Nullable String
    Cursor for the next page, or null if this is the last page.
    static <R> PaginatedResult<R>
    of(List<R> items, @Nullable String nextCursor, boolean cursorValid)
     
  • Method Details

    • items

      List<R> items()
      The items on this page.
    • nextCursor

      @Nullable String nextCursor()
      Cursor for the next page, or null if this is the last page.
    • hasMore

      default boolean hasMore()
      Returns true if there are more items beyond this page.
    • cursorValid

      boolean cursorValid()
      Returns true if the requested cursor was valid: either absent (first page) or found among the underlying items. false means a non-null cursor matched nothing, and per the MCP pagination spec the caller SHOULD raise -32602 (Invalid params).
    • builder

      static <R> PaginatedResult.Builder<R> builder()
    • of

      static <R> PaginatedResult<R> of(List<R> items, @Nullable String nextCursor, boolean cursorValid)