Skip to content

Unify return types in PageRequest. #2318

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @author Thomas Darimont
* @author Anastasiia Smirnova
* @author Mark Paluch
* @author Artur Signell
*/
public class PageRequest extends AbstractPageRequest {

Expand Down Expand Up @@ -118,7 +119,7 @@ public Pageable next() {
* @see org.springframework.data.domain.AbstractPageRequest#previous()
*/
@Override
public PageRequest previous() {
public Pageable previous() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rather change the other methods to return PageRequest as that is the more concrete type and we retain type-safety. Care to have a look?

return getPageNumber() == 0 ? this : new PageRequest(getPageNumber() - 1, getPageSize(), getSort());
}

Expand Down