Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "alias" methods to compute zero-based offset for one and zero-based pagination #830

Closed
sleberknight opened this issue Dec 28, 2022 · 0 comments · Fixed by #831
Closed
Assignees
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Milestone

Comments

@sleberknight
Copy link
Member

Add two new "alias" methods to KiwiSearching for ease of use and better API "ergonomics":

  • zeroBasedOffsetForOneBasedPaging(int pageNumber, int pageSize) - this is an alias of the original zeroBasedOffset(int pageNumber, int pageSize)
  • zeroBasedOffsetForZeroBasedPaging(int pageNumber, int pageSize) - this is a shorter way than calling the zeroBasedOffset overload that accepts a PageNumberingScheme

I'm adding this only because I was working in a service recently that was using zero-based paging, and I had to call zeroBasedOffset(pageNumber, PageNumberingScheme.ZERO_BASED, pageSize) in various places. This was annoying, so why not just add shorthand methods with names that are clear?

@sleberknight sleberknight added the new feature A new feature such as a new class, method, package, group of classes, etc. label Dec 28, 2022
@sleberknight sleberknight added this to the 2.5.0 milestone Dec 28, 2022
@sleberknight sleberknight self-assigned this Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant