DATACMNS-402 - Slight refinements in QSort implementation.
Re-enable concatenation with plain Sort via ….and(…) method. Some general polishing and JavaDoc cleanups. Original pull request: #59.
This commit is contained in:
@@ -21,6 +21,7 @@ import java.io.Serializable;
|
||||
* Abstract Java Bean implementation of {@code Pageable}.
|
||||
*
|
||||
* @author Thomas Darimont
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
|
||||
@@ -33,8 +34,8 @@ public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
* Creates a new {@link AbstractPageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return
|
||||
* the first page.
|
||||
*
|
||||
* @param page
|
||||
* @param size
|
||||
* @param page must not be less than zero.
|
||||
* @param size must not be less than one.
|
||||
*/
|
||||
public AbstractPageRequest(int page, int size) {
|
||||
|
||||
@@ -82,6 +83,14 @@ public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
return page > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Pageable#previousOrFirst()
|
||||
*/
|
||||
public Pageable previousOrFirst() {
|
||||
return hasPrevious() ? previous() : first();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Pageable#next()
|
||||
@@ -101,24 +110,19 @@ public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
*/
|
||||
public abstract Pageable first();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Pageable#previousOrFirst()
|
||||
*/
|
||||
public Pageable previousOrFirst() {
|
||||
return hasPrevious() ? previous() : first();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
|
||||
result = prime * result + page;
|
||||
result = prime * result + size;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -128,17 +132,16 @@ public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AbstractPageRequest other = (AbstractPageRequest) obj;
|
||||
if (page != other.page)
|
||||
return false;
|
||||
if (size != other.size)
|
||||
return false;
|
||||
return true;
|
||||
return this.page == other.page && this.size == other.size;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user