Browse Source

DATACMNS-1581 - Polishing.

Javadoc on (Q)PageRequest.
pull/420/head
Oliver Drotbohm 6 years ago
parent
commit
1fb8eadc44
No known key found for this signature in database
GPG Key ID: 6E42B5787543F690
  1. 24
      src/main/java/org/springframework/data/domain/PageRequest.java
  2. 8
      src/main/java/org/springframework/data/querydsl/QPageRequest.java

24
src/main/java/org/springframework/data/domain/PageRequest.java

@ -35,8 +35,8 @@ public class PageRequest extends AbstractPageRequest {
* Creates a new {@link PageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return the first * Creates a new {@link PageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return the first
* page. * page.
* *
* @param page zero-based page index. * @param page zero-based page index, must not be negative.
* @param size the size of the page to be returned. * @param size the size of the page to be returned, must be greater than 0.
* @deprecated use {@link #of(int, int)} instead. * @deprecated use {@link #of(int, int)} instead.
*/ */
@Deprecated @Deprecated
@ -47,9 +47,8 @@ public class PageRequest extends AbstractPageRequest {
/** /**
* Creates a new {@link PageRequest} with sort parameters applied. * Creates a new {@link PageRequest} with sort parameters applied.
* *
* @param page zero-based page index. * @param page zero-based page index, must not be negative.
* @param size the size of the page to be returned. * @param direction the direction of the {@link Sort} to be specified, must not be {@literal null}.
* @param direction the direction of the {@link Sort} to be specified, can be {@literal null}.
* @param properties the properties to sort by, must not be {@literal null} or empty. * @param properties the properties to sort by, must not be {@literal null} or empty.
* @deprecated use {@link #of(int, int, Direction, String...)} instead. * @deprecated use {@link #of(int, int, Direction, String...)} instead.
*/ */
@ -79,8 +78,8 @@ public class PageRequest extends AbstractPageRequest {
/** /**
* Creates a new unsorted {@link PageRequest}. * Creates a new unsorted {@link PageRequest}.
* *
* @param page zero-based page index. * @param page zero-based page index, must not be negative.
* @param size the size of the page to be returned. * @param size the size of the page to be returned, must be greater than 0.
* @since 2.0 * @since 2.0
*/ */
public static PageRequest of(int page, int size) { public static PageRequest of(int page, int size) {
@ -90,8 +89,8 @@ public class PageRequest extends AbstractPageRequest {
/** /**
* Creates a new {@link PageRequest} with sort parameters applied. * Creates a new {@link PageRequest} with sort parameters applied.
* *
* @param page zero-based page index. * @param page zero-based page index, must not be negative.
* @param size the size of the page to be returned. * @param size the size of the page to be returned, must be greater than 0.
* @param sort must not be {@literal null}. * @param sort must not be {@literal null}.
* @since 2.0 * @since 2.0
*/ */
@ -102,8 +101,8 @@ public class PageRequest extends AbstractPageRequest {
/** /**
* Creates a new {@link PageRequest} with sort direction and properties applied. * Creates a new {@link PageRequest} with sort direction and properties applied.
* *
* @param page zero-based page index. * @param page zero-based page index, must not be negative.
* @param size the size of the page to be returned. * @param size the size of the page to be returned, must be greater than 0.
* @param direction must not be {@literal null}. * @param direction must not be {@literal null}.
* @param properties must not be {@literal null}. * @param properties must not be {@literal null}.
* @since 2.0 * @since 2.0
@ -124,6 +123,7 @@ public class PageRequest extends AbstractPageRequest {
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.data.domain.Pageable#next() * @see org.springframework.data.domain.Pageable#next()
*/ */
@Override
public Pageable next() { public Pageable next() {
return new PageRequest(getPageNumber() + 1, getPageSize(), getSort()); return new PageRequest(getPageNumber() + 1, getPageSize(), getSort());
} }
@ -132,6 +132,7 @@ public class PageRequest extends AbstractPageRequest {
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.data.domain.AbstractPageRequest#previous() * @see org.springframework.data.domain.AbstractPageRequest#previous()
*/ */
@Override
public PageRequest previous() { public PageRequest previous() {
return getPageNumber() == 0 ? this : new PageRequest(getPageNumber() - 1, getPageSize(), getSort()); return getPageNumber() == 0 ? this : new PageRequest(getPageNumber() - 1, getPageSize(), getSort());
} }
@ -140,6 +141,7 @@ public class PageRequest extends AbstractPageRequest {
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.data.domain.Pageable#first() * @see org.springframework.data.domain.Pageable#first()
*/ */
@Override
public Pageable first() { public Pageable first() {
return new PageRequest(0, getPageSize(), getSort()); return new PageRequest(0, getPageSize(), getSort());
} }

8
src/main/java/org/springframework/data/querydsl/QPageRequest.java

@ -37,8 +37,8 @@ public class QPageRequest extends AbstractPageRequest {
* Creates a new {@link QPageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return the first * Creates a new {@link QPageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return the first
* page. * page.
* *
* @param page * @param page must not be negative.
* @param size * @param size must be greater or equal to 0.
*/ */
public QPageRequest(int page, int size) { public QPageRequest(int page, int size) {
this(page, size, QSort.unsorted()); this(page, size, QSort.unsorted());
@ -47,8 +47,8 @@ public class QPageRequest extends AbstractPageRequest {
/** /**
* Creates a new {@link QPageRequest} with the given {@link OrderSpecifier}s applied. * Creates a new {@link QPageRequest} with the given {@link OrderSpecifier}s applied.
* *
* @param page * @param page must not be negative.
* @param size * @param size must be greater or equal to 0.
* @param orderSpecifiers must not be {@literal null} or empty; * @param orderSpecifiers must not be {@literal null} or empty;
*/ */
public QPageRequest(int page, int size, OrderSpecifier<?>... orderSpecifiers) { public QPageRequest(int page, int size, OrderSpecifier<?>... orderSpecifiers) {

Loading…
Cancel
Save