From a73b0d9936d71f173ac63ab0b3201650f70b1fab Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 23 Aug 2022 10:34:32 +0200 Subject: [PATCH] Improve Pageable Javadoc. Closes #2679 --- .../springframework/data/domain/Pageable.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/springframework/data/domain/Pageable.java b/src/main/java/org/springframework/data/domain/Pageable.java index 3979fbb68..af26ab2c0 100644 --- a/src/main/java/org/springframework/data/domain/Pageable.java +++ b/src/main/java/org/springframework/data/domain/Pageable.java @@ -68,21 +68,27 @@ public interface Pageable { /** * Returns the page to be returned. * - * @return the page to be returned. + * @return the page to be returned or throws {@link UnsupportedOperationException} if the object is + * {@link #isUnpaged()}. + * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}. */ int getPageNumber(); /** * Returns the number of items to be returned. * - * @return the number of items of that page + * @return the number of items of that page or throws {@link UnsupportedOperationException} if the object is + * {@link #isUnpaged()}. + * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}. */ int getPageSize(); /** * Returns the offset to be taken according to the underlying page and page size. * - * @return the offset to be taken + * @return the offset to be taken or throws {@link UnsupportedOperationException} if the object is + * {@link #isUnpaged()}. + * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}. */ long getOffset(); @@ -131,8 +137,10 @@ public interface Pageable { * Creates a new {@link Pageable} with {@code pageNumber} applied. * * @param pageNumber - * @return a new {@link PageRequest}. + * @return a new {@link PageRequest} or throws {@link UnsupportedOperationException} if the object is + * {@link #isUnpaged()} and the {@code pageNumber} is not zero. * @since 2.5 + * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}. */ Pageable withPage(int pageNumber);