DATACMNS-867 - Cleanups in Pageable API.

Dropped Pageable.NONE in favor of ….unpaged() for consistency with Sort.unsorted(). Extracted the implementation for the value backing it into an Unpaged enum instance. Introduced defaulted isPaged() / isUnpaged() to avoid having to compare instances.

JavaDoc in Sort and a couple of API polishes.
This commit is contained in:
Oliver Gierke
2017-02-24 12:43:27 +01:00
parent a5c4be5f0a
commit 8372e34adf
13 changed files with 236 additions and 78 deletions

View File

@@ -72,7 +72,7 @@ public class PageImplUnitTests {
assertThat(page.isFirst()).isTrue();
assertThat(page.hasPrevious()).isFalse();
assertThat(page.previousPageable()).isEqualTo(Pageable.NONE);
assertThat(page.previousPageable().isPaged()).isFalse();
assertThat(page.isLast()).isFalse();
assertThat(page.hasNext()).isTrue();
@@ -90,7 +90,7 @@ public class PageImplUnitTests {
assertThat(page.isLast()).isTrue();
assertThat(page.hasNext()).isFalse();
assertThat(page.nextPageable()).isEqualTo(Pageable.NONE);
assertThat(page.nextPageable().isPaged()).isFalse();
}
@Test
@@ -158,7 +158,7 @@ public class PageImplUnitTests {
@Test // DATACMNS-713
public void doesNotAdapttotalIfPageIsEmpty() {
assertThat(new PageImpl<>(Collections.<String>emptyList(), PageRequest.of(1, 10), 0).getTotalElements())
assertThat(new PageImpl<>(Collections.<String> emptyList(), PageRequest.of(1, 10), 0).getTotalElements())
.isEqualTo(0L);
}
}