Class PaginationSpec<T>
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.pagination.PaginationSpec<T>
- Type Parameters:
T- the element type served by the source
Immutable pagination declaration built by
PaginationBuilderImpl.build(): geometry,
paint target, renderer and frame items, the source declaration, and the async plumbing
consumed by PaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler). All
combination validation happens in the builder before a spec is constructed; the spec only
carries the validated values.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow elements are distributed across pages.static enumWhere the page items are painted. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the async cache LRU bound, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).@Nullable DurationcacheTtl()Returns the async cache TTL, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).@Nullable Function<ViewContext,org.bukkit.inventory.ItemStack> Returns the empty-state item painted atemptyStateSlots()when the current page settled with no elements.int[]Returns the absolute slots the empty-state item paints into.@Nullable PaginationErrorCallbackReturns the async error callback, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).@Nullable LayoutReturns the explicit fill order.@Nullable Function<ViewContext,org.bukkit.inventory.ItemStack> Returns the frame item painted into page slots not covered by an element.@NotNull PaginationSpec.Geometrygeometry()Returns the page geometry.charReturns the target layout character, meaningful only whentarget()isPaginationSpec.Target.LAYOUT_CHAR.@Nullable Function<ViewContext,org.bukkit.inventory.ItemStack> Returns the frame item painted into every page slot while an async load is in flight.int[]Returns the absolute slots the loading item paints into.patterns()Returns the per-page patterns.@NotNull PaginationItemRenderer<T>renderer()Returns the per-element renderer.@Nullable DurationReturns the async per-request timeout, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).@NotNull PaginationSourceSpec<T>source()Returns the source declaration.@NotNull PaginationSpec.Targettarget()Returns the paint target.
-
Method Details
-
geometry
Returns the page geometry.- Returns:
- the geometry
-
target
Returns the paint target.- Returns:
- the target
-
layoutChar
public char layoutChar()Returns the target layout character, meaningful only whentarget()isPaginationSpec.Target.LAYOUT_CHAR.- Returns:
- the layout character,
'O'by default
-
explicitLayout
Returns the explicit fill order.- Returns:
- the explicit layout, or null unless
target()isPaginationSpec.Target.EXPLICIT_LAYOUT
-
patterns
Returns the per-page patterns.- Returns:
- an unmodifiable list; empty unless
target()isPaginationSpec.Target.PATTERNS
-
renderer
Returns the per-element renderer.- Returns:
- the renderer
-
fallbackItem
Returns the frame item painted into page slots not covered by an element.- Returns:
- the fallback item factory, or null when uncovered slots are cleared
-
loadingItem
Returns the frame item painted into every page slot while an async load is in flight.- Returns:
- the loading item factory, or null
-
source
Returns the source declaration.- Returns:
- the source spec
-
errorCallback
Returns the async error callback, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).- Returns:
- the callback, or null
-
requestTimeout
Returns the async per-request timeout, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).- Returns:
- the timeout, or null when disabled
-
cacheTtl
Returns the async cache TTL, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).- Returns:
- the TTL, or null when caching is disabled
-
cacheMaxPages
public int cacheMaxPages()Returns the async cache LRU bound, consumed byPaginationSourceSpec.createSource(ViewContext, PaginationSpec, tech.guilhermekaua.spigotboot.core.spigot.scheduler.PlatformScheduler).- Returns:
- the bound; 128 unless overridden (the 2.x
DEFAULT_CACHE_MAX_PAGES)
-
emptyStateItem
Returns the empty-state item painted atemptyStateSlots()when the current page settled with no elements.- Returns:
- the empty-state item factory, or null when no empty-state is declared
-
emptyStateSlots
public int[] emptyStateSlots()Returns the absolute slots the empty-state item paints into.- Returns:
- a defensive copy; empty when no empty-state is declared
-
loadingSlots
public int[] loadingSlots()Returns the absolute slots the loading item paints into.- Returns:
- a defensive copy; empty when the loading item fills the whole layout
-