java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.pagination.source.PageRequest

public final class PageRequest extends Object
Immutable description of one page load issued by a paginator; safe to share across threads.

offset and pageSize are the authoritative query bounds — a backing store should fetch with LIMIT pageSize OFFSET offset. page is informational only: scroll paginators advance one element per page, so deriving the offset as (page - 1) * pageSize is wrong for them.

playerId identifies who the page is loaded for and plugin owns the load. viewer is the live Player the settle dispatcher uses to route the settle to the viewer's region thread (Folia) or the main thread (legacy). All three are null only for engine-external test usage — requests dispatched by the built-in paginators always populate them.

  • Constructor Summary

    Constructors
    Constructor
    Description
    PageRequest(int page, int pageSize, int offset, @Nullable UUID playerId, @Nullable org.bukkit.plugin.Plugin plugin, @Nullable org.bukkit.entity.Player viewer)
    Creates a page request.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the global element offset of the first item on the requested page — together with getPageSize() the authoritative query bound: LIMIT pageSize OFFSET offset.
    int
    Returns the 1-indexed page being requested.
    int
    Returns the maximum number of items the requested page can display.
    @Nullable UUID
    Returns the unique id of the player the page is being loaded for.
    @Nullable org.bukkit.plugin.Plugin
    Returns the plugin that owns the load.
    @Nullable org.bukkit.entity.Player
    Returns the live viewer the settle dispatcher uses to route the settle to the correct region thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PageRequest

      public PageRequest(int page, int pageSize, int offset, @Nullable @Nullable UUID playerId, @Nullable @Nullable org.bukkit.plugin.Plugin plugin, @Nullable @Nullable org.bukkit.entity.Player viewer)
      Creates a page request.
      Parameters:
      page - the 1-indexed page being requested; informational only
      pageSize - the maximum number of items the requested page can display
      offset - the global element offset of the first item on the requested page
      playerId - the player the page is being loaded for, or null only for engine-external test usage
      plugin - the plugin owning the load, or null only for engine-external test usage
      viewer - the live Player the settle dispatcher routes the settle for; null only for engine-external test usage, in which case the settle runs inline on the completing thread
  • Method Details

    • getPage

      public int getPage()
      Returns the 1-indexed page being requested. Informational only — scroll paginators slide one element per page, so the offset must never be derived from it.
      Returns:
      the 1-indexed page
    • getPageSize

      public int getPageSize()
      Returns the maximum number of items the requested page can display.
      Returns:
      the page size
    • getOffset

      public int getOffset()
      Returns the global element offset of the first item on the requested page — together with getPageSize() the authoritative query bound: LIMIT pageSize OFFSET offset.
      Returns:
      the element offset
    • playerId

      @Nullable public @Nullable UUID playerId()
      Returns the unique id of the player the page is being loaded for.
      Returns:
      the player id, or null only for engine-external test usage
    • plugin

      @Nullable public @Nullable org.bukkit.plugin.Plugin plugin()
      Returns the plugin that owns the load. Informational: the built-in BukkitSettleDispatcher routes settles by viewer() via the platform scheduler and does not use this; a custom SettleDispatcher may use it.
      Returns:
      the owning plugin, or null only for engine-external test usage
    • viewer

      @Nullable public @Nullable org.bukkit.entity.Player viewer()
      Returns the live viewer the settle dispatcher uses to route the settle to the correct region thread. On Folia each player's inventory is owned by the region containing the player; the settle must run on that region's thread. On legacy Spigot/Paper the dispatcher falls back to the main thread.
      Returns:
      the viewing player, or null only for engine-external test usage (in which case the settle runs inline on the completing thread)