|
16 | 16 | package org.springframework.data.redis.core.convert; |
17 | 17 |
|
18 | 18 | import org.springframework.data.geo.Point; |
| 19 | +import org.springframework.util.ObjectUtils; |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * {@link IndexedData} implementation indicating storage of data within a Redis GEO structure. |
@@ -73,45 +74,41 @@ public Point getValue() { |
73 | 74 | return this.value; |
74 | 75 | } |
75 | 76 |
|
76 | | - public boolean equals(final Object o) { |
77 | | - if (o == this) |
| 77 | + @Override |
| 78 | + public boolean equals(Object o) { |
| 79 | + |
| 80 | + if (this == o) { |
78 | 81 | return true; |
79 | | - if (!(o instanceof GeoIndexedPropertyValue)) |
80 | | - return false; |
81 | | - final GeoIndexedPropertyValue other = (GeoIndexedPropertyValue) o; |
82 | | - if (!other.canEqual((Object) this)) |
83 | | - return false; |
84 | | - final Object this$keyspace = this.getKeyspace(); |
85 | | - final Object other$keyspace = other.getKeyspace(); |
86 | | - if (this$keyspace == null ? other$keyspace != null : !this$keyspace.equals(other$keyspace)) |
| 82 | + } |
| 83 | + |
| 84 | + if (!(o instanceof GeoIndexedPropertyValue)) { |
87 | 85 | return false; |
88 | | - final Object this$indexName = this.getIndexName(); |
89 | | - final Object other$indexName = other.getIndexName(); |
90 | | - if (this$indexName == null ? other$indexName != null : !this$indexName.equals(other$indexName)) |
| 86 | + } |
| 87 | + |
| 88 | + GeoIndexedPropertyValue that = (GeoIndexedPropertyValue) o; |
| 89 | + if (!ObjectUtils.nullSafeEquals(keyspace, that.keyspace)) { |
91 | 90 | return false; |
92 | | - final Object this$value = this.getValue(); |
93 | | - final Object other$value = other.getValue(); |
94 | | - if (this$value == null ? other$value != null : !this$value.equals(other$value)) |
| 91 | + } |
| 92 | + |
| 93 | + if (!ObjectUtils.nullSafeEquals(indexName, that.indexName)) { |
95 | 94 | return false; |
96 | | - return true; |
97 | | - } |
| 95 | + } |
98 | 96 |
|
99 | | - protected boolean canEqual(final Object other) { |
100 | | - return other instanceof GeoIndexedPropertyValue; |
| 97 | + return ObjectUtils.nullSafeEquals(value, that.value); |
101 | 98 | } |
102 | 99 |
|
| 100 | + @Override |
103 | 101 | public int hashCode() { |
104 | | - final int PRIME = 59; |
105 | | - int result = 1; |
106 | | - final Object $keyspace = this.getKeyspace(); |
107 | | - result = result * PRIME + ($keyspace == null ? 43 : $keyspace.hashCode()); |
108 | | - final Object $indexName = this.getIndexName(); |
109 | | - result = result * PRIME + ($indexName == null ? 43 : $indexName.hashCode()); |
110 | | - final Object $value = this.getValue(); |
111 | | - result = result * PRIME + ($value == null ? 43 : $value.hashCode()); |
| 102 | + int result = ObjectUtils.nullSafeHashCode(keyspace); |
| 103 | + result = 31 * result + ObjectUtils.nullSafeHashCode(indexName); |
| 104 | + result = 31 * result + ObjectUtils.nullSafeHashCode(value); |
112 | 105 | return result; |
113 | 106 | } |
114 | 107 |
|
| 108 | + protected boolean canEqual(Object other) { |
| 109 | + return other instanceof GeoIndexedPropertyValue; |
| 110 | + } |
| 111 | + |
115 | 112 | public String toString() { |
116 | 113 | return "GeoIndexedPropertyValue(keyspace=" + this.getKeyspace() + ", indexName=" + this.getIndexName() + ", value=" |
117 | 114 | + this.getValue() + ")"; |
|
0 commit comments