Class Paging

java.lang.Object
de.sfuhrm.radiobrowser4j.Paging

public final class Paging extends Object
Immutable paging configuration. The paging is used to address a sub list that can be retrieved in one logical page. This enables the client to itereate through a long list without needing to store the whole result in memory.
Author:
Stephan Fuhrmann
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Paging
    A default start page with offset 0 and limit 64.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    apply(jakarta.ws.rs.core.MultivaluedMap<String,String> requestParams)
    Applies the parameters stored in this instance to the given request parameters.
    static Paging
    at(int offset, int limit)
    Creates a new paging at the given offset and limit.
    Address the next paging.
    Address the previous paging.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_START

      public static final Paging DEFAULT_START
      A default start page with offset 0 and limit 64.
  • Method Details

    • at

      public static Paging at(int offset, int limit)
      Creates a new paging at the given offset and limit.
      Parameters:
      offset - the positive offset of the page.
      limit - the maximum number of entries.
      Returns:
      the paging instance created.
    • previous

      public Paging previous()
      Address the previous paging. Will never go beyond offset 0.
      Returns:
      returns the paging at offset - limit and keeps the limit. Will return 0 if going beyond offset 0.
    • next

      public Paging next()
      Address the next paging.
      Returns:
      returns the paging at offset + limit and keeps the limit.
    • apply

      protected void apply(jakarta.ws.rs.core.MultivaluedMap<String,String> requestParams)
      Applies the parameters stored in this instance to the given request parameters.
      Parameters:
      requestParams - the parameters to apply the instance content to.