@@ -68,21 +68,27 @@ default boolean isUnpaged() {
6868 /**
6969 * Returns the page to be returned.
7070 *
71- * @return the page to be returned.
71+ * @return the page to be returned or throws {@link UnsupportedOperationException} if the object is
72+ * {@link #isUnpaged()}.
73+ * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}.
7274 */
7375 int getPageNumber ();
7476
7577 /**
7678 * Returns the number of items to be returned.
7779 *
78- * @return the number of items of that page
80+ * @return the number of items of that page or throws {@link UnsupportedOperationException} if the object is
81+ * {@link #isUnpaged()}.
82+ * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}.
7983 */
8084 int getPageSize ();
8185
8286 /**
8387 * Returns the offset to be taken according to the underlying page and page size.
8488 *
85- * @return the offset to be taken
89+ * @return the offset to be taken or throws {@link UnsupportedOperationException} if the object is
90+ * {@link #isUnpaged()}.
91+ * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}.
8692 */
8793 long getOffset ();
8894
@@ -131,8 +137,10 @@ default Sort getSortOr(Sort sort) {
131137 * Creates a new {@link Pageable} with {@code pageNumber} applied.
132138 *
133139 * @param pageNumber
134- * @return a new {@link PageRequest}.
140+ * @return a new {@link PageRequest} or throws {@link UnsupportedOperationException} if the object is
141+ * {@link #isUnpaged()} and the {@code pageNumber} is not zero.
135142 * @since 2.5
143+ * @throws UnsupportedOperationException if the object is {@link #isUnpaged()}.
136144 */
137145 Pageable withPage (int pageNumber );
138146
0 commit comments