Class PaginationParameter.PaginationParameterBuilder

java.lang.Object
org.nuiton.util.pagination.PaginationParameter.PaginationParameterBuilder
Enclosing class:
PaginationParameter

public static class PaginationParameter.PaginationParameterBuilder extends Object
Class used to build an instance of PaginationParameter. Use the build() method to create the PaginationParameter.
Since:
3.0
Author:
Arnaud Thimel (Code Lutin)
  • Field Details

    • pageNumber

      protected int pageNumber
    • pageSize

      protected int pageSize
    • orderClauses

      protected List<PaginationOrder> orderClauses
  • Constructor Details

    • PaginationParameterBuilder

      public PaginationParameterBuilder(int pageNumber, int pageSize)
      Creates a Builder instance
      Parameters:
      pageNumber - the index (0-based) of the page
      pageSize - the size of each page. Value can be -1 (for infinite pageSize) or greater than 0
  • Method Details

    • addOrder

      public PaginationParameter.PaginationParameterBuilder addOrder(String clause, boolean desc)
      Adds an order clause
      Parameters:
      clause - an order clause attribute name. It comes together with {code}desc{/code}
      desc - the asc/desc property associated with {code}clause{/code}
      Returns:
      the current Builder for a Fluent usage
    • addAscOrder

      Adds an ASC order clause
      Parameters:
      clause - an order clause attribute name
      Returns:
      the current Builder for a Fluent usage
    • addDescOrder

      Adds an DESC order clause
      Parameters:
      clause - an order clause attribute name
      Returns:
      the current Builder for a Fluent usage
    • addOrder

      Adds an order clause. The asc/desc value is guessed from the given {code}clause{/code}. The expected format is "column asc" or "column desc"
      Parameters:
      clause - an order clause attribute name. It comes together with {code}desc{/code}
      Returns:
      the current Builder for a Fluent usage
    • addOrderClauses

      Adds an the given order clauses
      Parameters:
      clauses - an list of order clauses
      Returns:
      the current Builder for a Fluent usage
    • build

      public PaginationParameter build()
      Final method that instantiates the immutable PaginationParameter
      Returns:
      the immutable PaginationParameter built