DATACMNS-601 - Fixes for most of the SonarQube warnings.

This commit is contained in:
Oliver Gierke
2014-11-26 09:10:00 +01:00
parent 9a1879617e
commit e1b38faee9
31 changed files with 158 additions and 131 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.data.geo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
/**
* Custom {@link Page} to carry the average distance retrieved from the {@link GeoResults} the {@link GeoPage} is set up
@@ -66,4 +67,33 @@ public class GeoPage<T> extends PageImpl<GeoResult<T>> {
public Distance getAverageDistance() {
return averageDistance;
}
/*
* (non-Javadoc)
* @see org.springframework.data.domain.PageImpl#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof GeoPage)) {
return false;
}
GeoPage<?> that = (GeoPage<?>) obj;
return super.equals(obj) && ObjectUtils.nullSafeEquals(this.averageDistance, that.averageDistance);
}
/*
* (non-Javadoc)
* @see org.springframework.data.domain.PageImpl#hashCode()
*/
@Override
public int hashCode() {
return super.hashCode() + ObjectUtils.nullSafeHashCode(this.averageDistance);
}
}