From e30928dcf0576532fd477abcf960d62c8661ee94 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 15 Dec 2017 15:13:18 +0100 Subject: [PATCH] DATACMNS-1236 - Fix inconsistent Pageable nullability Javadoc. Fix Javadoc to reflect Pageable's non-nullability. Also, remove pageable field in favor of using Chunk's Pageable getter. --- .../java/org/springframework/data/domain/PageImpl.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/data/domain/PageImpl.java b/src/main/java/org/springframework/data/domain/PageImpl.java index a56d55961..d9cdb2f89 100644 --- a/src/main/java/org/springframework/data/domain/PageImpl.java +++ b/src/main/java/org/springframework/data/domain/PageImpl.java @@ -25,27 +25,26 @@ import org.springframework.lang.Nullable; * * @param the type of which the page consists. * @author Oliver Gierke + * @author Mark Paluch */ public class PageImpl extends Chunk implements Page { private static final long serialVersionUID = 867755909294344406L; private final long total; - private final Pageable pageable; /** * Constructor of {@code PageImpl}. * * @param content the content of this page, must not be {@literal null}. - * @param pageable the paging information, can be {@literal null}. + * @param pageable the paging information, must not be {@literal null}. * @param total the total amount of items available. The total might be adapted considering the length of the content - * given, if it is going to be the content of the last page. This is in place to mitigate inconsistencies + * given, if it is going to be the content of the last page. This is in place to mitigate inconsistencies. */ public PageImpl(List content, Pageable pageable, long total) { super(content, pageable); - this.pageable = pageable; this.total = pageable.toOptional().filter(it -> !content.isEmpty())// .filter(it -> it.getOffset() + it.getPageSize() > total)// .map(it -> it.getOffset() + content.size())// @@ -104,7 +103,7 @@ public class PageImpl extends Chunk implements Page { */ @Override public Page map(Function converter) { - return new PageImpl<>(getConvertedContent(converter), pageable, total); + return new PageImpl<>(getConvertedContent(converter), getPageable(), total); } /*