Module io.ebean.api
Package io.ebean

Interface Paging


public interface Paging
Used to specify Paging on a Query as an alternative to setting each of the maxRows, firstRow and orderBy clause via: QueryBuilder.setMaxRows(int) + QueryBuilder.setFirstRow(int) + QueryBuilder.setOrderBy(OrderBy).

Example use:



   var orderBy = OrderBy.of("lastName desc nulls first, firstName asc");
   var paging = Paging.of(0, 100, orderBy);

   new QCustomer()
       .name.isNotNull()
       .setPaging(paging)
       .findList();

 
  • Method Summary

    Modifier and Type
    Method
    Description
    static Paging
    of(int pageIndex, int pageSize)
    Create a Paging that will use the id property for ordering.
    static Paging
    of(int pageIndex, int pageSize, @Nullable OrderBy<?> orderBy)
    Create a Paging with the given page index size and orderBy.
    static Paging
    of(int pageIndex, int pageSize, @Nullable String orderByClause)
    Create a Paging with a raw order by clause.
    static Paging
    Return a Paging that will not apply any pagination to a query.
    Return the order by.
    int
    Return the page index.
    int
    Return the page size.
    withOrderBy(String orderByClause)
    Return a Paging using the given order by clause.
    withPage(int pageIndex)
    Return a Paging using the given page index.
  • Method Details

    • of

      static Paging of(int pageIndex, int pageSize, @Nullable OrderBy<?> orderBy)
      Create a Paging with the given page index size and orderBy.
      Parameters:
      pageIndex - the page index starting from zero
      pageSize - the page size (effectively max rows)
      orderBy - order by for the query result
    • of

      static Paging of(int pageIndex, int pageSize, @Nullable String orderByClause)
      Create a Paging with a raw order by clause.
      Parameters:
      pageIndex - the page index starting from zero
      pageSize - the page size (effectively max rows)
      orderByClause - raw order by clause for ordering the query result
    • of

      static Paging of(int pageIndex, int pageSize)
      Create a Paging that will use the id property for ordering.
      Parameters:
      pageIndex - the page index starting from zero
      pageSize - the page size (effectively max rows)
    • ofNone

      static Paging ofNone()
      Return a Paging that will not apply any pagination to a query.
    • pageIndex

      int pageIndex()
      Return the page index.
    • pageSize

      int pageSize()
      Return the page size.
    • orderBy

      OrderBy<?> orderBy()
      Return the order by.
    • withPage

      Paging withPage(int pageIndex)
      Return a Paging using the given page index.
    • withOrderBy

      Paging withOrderBy(String orderByClause)
      Return a Paging using the given order by clause.