DATAREDIS-1143 - Polishing.

Replace delomboked equals/hashCode with Spring-style equals/hashCode.

Original pull request: #530.
This commit is contained in:
Mark Paluch
2020-05-14 11:58:24 +02:00
parent 51cba2bcb1
commit 2bcb06acc8
3 changed files with 50 additions and 54 deletions

View File

@@ -351,7 +351,7 @@ public interface ReactiveRedisConnection extends Closeable {
private final I input;
private final @Nullable O output;
public CommandResponse(I input, O output) {
public CommandResponse(I input, @Nullable O output) {
this.input = input;
this.output = output;
}

View File

@@ -28,6 +28,7 @@ import org.springframework.data.geo.Metric;
import org.springframework.data.geo.Point;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Geo-specific Redis commands.
@@ -370,39 +371,37 @@ public interface RedisGeoCommands {
return this.point;
}
public boolean equals(final Object o) {
if (o == this)
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
if (!(o instanceof GeoLocation))
}
if (!(o instanceof GeoLocation)) {
return false;
final GeoLocation<?> other = (GeoLocation<?>) o;
if (!other.canEqual((Object) this))
}
GeoLocation<?> that = (GeoLocation<?>) o;
if (!ObjectUtils.nullSafeEquals(name, that.name)) {
return false;
final Object this$name = this.getName();
final Object other$name = other.getName();
if (this$name == null ? other$name != null : !this$name.equals(other$name))
return false;
final Object this$point = this.getPoint();
final Object other$point = other.getPoint();
if (this$point == null ? other$point != null : !this$point.equals(other$point))
return false;
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof GeoLocation;
}
return ObjectUtils.nullSafeEquals(point, that.point);
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $name = this.getName();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
final Object $point = this.getPoint();
result = result * PRIME + ($point == null ? 43 : $point.hashCode());
int result = ObjectUtils.nullSafeHashCode(name);
result = 31 * result + ObjectUtils.nullSafeHashCode(point);
return result;
}
protected boolean canEqual(Object other) {
return other instanceof GeoLocation;
}
public String toString() {
return "RedisGeoCommands.GeoLocation(name=" + this.getName() + ", point=" + this.getPoint() + ")";
}

View File

@@ -16,6 +16,7 @@
package org.springframework.data.redis.core.convert;
import org.springframework.data.geo.Point;
import org.springframework.util.ObjectUtils;
/**
* {@link IndexedData} implementation indicating storage of data within a Redis GEO structure.
@@ -73,45 +74,41 @@ public class GeoIndexedPropertyValue implements IndexedData {
return this.value;
}
public boolean equals(final Object o) {
if (o == this)
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
if (!(o instanceof GeoIndexedPropertyValue))
}
if (!(o instanceof GeoIndexedPropertyValue)) {
return false;
final GeoIndexedPropertyValue other = (GeoIndexedPropertyValue) o;
if (!other.canEqual((Object) this))
}
GeoIndexedPropertyValue that = (GeoIndexedPropertyValue) o;
if (!ObjectUtils.nullSafeEquals(keyspace, that.keyspace)) {
return false;
final Object this$keyspace = this.getKeyspace();
final Object other$keyspace = other.getKeyspace();
if (this$keyspace == null ? other$keyspace != null : !this$keyspace.equals(other$keyspace))
}
if (!ObjectUtils.nullSafeEquals(indexName, that.indexName)) {
return false;
final Object this$indexName = this.getIndexName();
final Object other$indexName = other.getIndexName();
if (this$indexName == null ? other$indexName != null : !this$indexName.equals(other$indexName))
return false;
final Object this$value = this.getValue();
final Object other$value = other.getValue();
if (this$value == null ? other$value != null : !this$value.equals(other$value))
return false;
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof GeoIndexedPropertyValue;
}
return ObjectUtils.nullSafeEquals(value, that.value);
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $keyspace = this.getKeyspace();
result = result * PRIME + ($keyspace == null ? 43 : $keyspace.hashCode());
final Object $indexName = this.getIndexName();
result = result * PRIME + ($indexName == null ? 43 : $indexName.hashCode());
final Object $value = this.getValue();
result = result * PRIME + ($value == null ? 43 : $value.hashCode());
int result = ObjectUtils.nullSafeHashCode(keyspace);
result = 31 * result + ObjectUtils.nullSafeHashCode(indexName);
result = 31 * result + ObjectUtils.nullSafeHashCode(value);
return result;
}
protected boolean canEqual(Object other) {
return other instanceof GeoIndexedPropertyValue;
}
public String toString() {
return "GeoIndexedPropertyValue(keyspace=" + this.getKeyspace() + ", indexName=" + this.getIndexName() + ", value="
+ this.getValue() + ")";