Add Nullable annotation to parameter of overridden equals method.
Closes: #2450 Original pull request: #2451
This commit is contained in:
committed by
Mark Paluch
parent
3cd61827c0
commit
66d44b1671
6
src/main/asciidoc/observability/_conventions.adoc
Normal file
6
src/main/asciidoc/observability/_conventions.adoc
Normal file
@@ -0,0 +1,6 @@
|
||||
[[observability-conventions]]
|
||||
=== Observability - Conventions
|
||||
|
||||
Below you can find a list of all `GlobalObservabilityConventions` and `ObservabilityConventions` declared by this project.
|
||||
|
||||
|
||||
42
src/main/asciidoc/observability/_metrics.adoc
Normal file
42
src/main/asciidoc/observability/_metrics.adoc
Normal file
@@ -0,0 +1,42 @@
|
||||
[[observability-metrics]]
|
||||
=== Observability - Metrics
|
||||
|
||||
Below you can find a list of all metrics declared by this project.
|
||||
|
||||
[[observability-metrics-redis-command-observation]]
|
||||
==== Redis Command Observation
|
||||
|
||||
____
|
||||
Timer created around a Redis command execution.
|
||||
____
|
||||
|
||||
**Metric name** `spring.data.redis`. **Type** `timer` and **base unit** `seconds`.
|
||||
|
||||
Fully qualified name of the enclosing class `org.springframework.data.redis.connection.lettuce.observability.RedisObservation`.
|
||||
|
||||
|
||||
|
||||
.Low cardinality Keys
|
||||
[cols="a,a"]
|
||||
|===
|
||||
|Name | Description
|
||||
|`db.operation`|Redis command value.
|
||||
|`db.redis.database_index`|Redis database index.
|
||||
|`db.system`|Database system.
|
||||
|`db.user`|Redis user.
|
||||
|`net.peer.name`|Name of the database host.
|
||||
|`net.peer.port`|Logical remote port number.
|
||||
|`net.sock.peer.addr`|Mongo peer address.
|
||||
|`net.sock.peer.port`|Mongo peer port.
|
||||
|`net.transport`|Network transport.
|
||||
|===
|
||||
|
||||
.High cardinality Keys
|
||||
[cols="a,a"]
|
||||
|===
|
||||
|Name | Description
|
||||
|`db.statement`|Redis statement.
|
||||
|`spring.data.redis.command.error`|Redis error response.
|
||||
|===
|
||||
|
||||
|
||||
35
src/main/asciidoc/observability/_spans.adoc
Normal file
35
src/main/asciidoc/observability/_spans.adoc
Normal file
@@ -0,0 +1,35 @@
|
||||
[[observability-spans]]
|
||||
=== Observability - Spans
|
||||
|
||||
Below you can find a list of all spans declared by this project.
|
||||
|
||||
[[observability-spans-redis-command-observation]]
|
||||
==== Redis Command Observation Span
|
||||
|
||||
> Timer created around a Redis command execution.
|
||||
|
||||
**Span name** `spring.data.redis`.
|
||||
|
||||
Fully qualified name of the enclosing class `org.springframework.data.redis.connection.lettuce.observability.RedisObservation`.
|
||||
|
||||
|
||||
|
||||
.Tag Keys
|
||||
|===
|
||||
|Name | Description
|
||||
|`db.operation`|Redis command value.
|
||||
|`db.redis.database_index`|Redis database index.
|
||||
|`db.statement`|Redis statement.
|
||||
|`db.system`|Database system.
|
||||
|`db.user`|Redis user.
|
||||
|`net.peer.name`|Name of the database host.
|
||||
|`net.peer.port`|Logical remote port number.
|
||||
|`net.sock.peer.addr`|Mongo peer address.
|
||||
|`net.sock.peer.port`|Mongo peer port.
|
||||
|`net.transport`|Network transport.
|
||||
|`spring.data.redis.command.error`|Redis error response.
|
||||
|===
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.redis.cache;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -184,7 +185,7 @@ enum NoOpCacheStatisticsCollector implements CacheStatisticsCollector {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
|
||||
@@ -155,7 +155,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
@@ -576,7 +576,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
@@ -644,7 +644,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
@@ -744,7 +744,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
@@ -915,7 +915,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
|
||||
@@ -682,7 +682,7 @@ public class ClusterCommandExecutor implements DisposableBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -77,7 +78,7 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.Arrays;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Default implementation for {@link Tuple} interface.
|
||||
*
|
||||
@@ -58,7 +60,7 @@ public class DefaultTuple implements Tuple {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
|
||||
@@ -374,7 +374,7 @@ public interface ReactiveRedisConnection extends Closeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -194,7 +195,7 @@ public interface ReactiveSubscription {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
@@ -260,7 +261,7 @@ public interface ReactiveSubscription {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -227,7 +227,7 @@ public class RedisClusterConfiguration implements RedisConfiguration, ClusterCon
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class RedisNode implements NamedNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
|
||||
@@ -148,7 +148,7 @@ public class RedisPassword {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
@@ -320,7 +320,7 @@ public class RedisSentinelConfiguration implements RedisConfiguration, SentinelC
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class RedisSocketConfiguration implements RedisConfiguration, DomainSocke
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class RedisStandaloneConfiguration
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class RedisStaticMasterReplicaConfiguration implements RedisConfiguration
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ public interface RedisStreamCommands {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ public interface RedisZSetCommands {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.springframework.data.redis.connection;
|
||||
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -58,7 +59,7 @@ class SentinelMasterId implements NamedNode {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1615,7 +1615,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.stream;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -64,7 +65,7 @@ public class Consumer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.stream;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -81,7 +82,7 @@ public final class ReadOffset {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
@@ -154,7 +154,7 @@ public class RecordId {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.stream;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -101,7 +102,7 @@ public final class StreamOffset<K> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
@@ -131,7 +131,7 @@ public class StreamReadOptions {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -281,7 +281,7 @@ public class StreamRecords {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (o == null) {
|
||||
return false;
|
||||
@@ -430,7 +430,7 @@ public class StreamRecords {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -17,6 +17,8 @@ package org.springframework.data.redis.connection.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple wrapper class used for wrapping arrays so they can be used as keys inside maps.
|
||||
*
|
||||
@@ -32,7 +34,7 @@ public class ByteArrayWrapper {
|
||||
this.hashCode = Arrays.hashCode(array);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj instanceof ByteArrayWrapper) {
|
||||
return Arrays.equals(array, ((ByteArrayWrapper) obj).array);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.redis.connection.zset;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.DoubleUnaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.DoubleStream;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Value object encapsulating a multiplication factor for each input sorted set. This means that the score of every
|
||||
* element in every input sorted set is multiplied by this factor before being passed to the aggregation function.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
public class Weights {
|
||||
|
||||
private final List<Double> weights;
|
||||
|
||||
private Weights(List<Double> weights) {
|
||||
this.weights = weights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new {@link Weights} given {@code weights} as {@code int}.
|
||||
*
|
||||
* @param weights must not be {@literal null}.
|
||||
* @return the {@link Weights} for {@code weights}.
|
||||
*/
|
||||
public static Weights of(int... weights) {
|
||||
|
||||
Assert.notNull(weights, "Weights must not be null");
|
||||
return new Weights(Arrays.stream(weights).mapToDouble(value -> value).boxed().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new {@link Weights} given {@code weights} as {@code double}.
|
||||
*
|
||||
* @param weights must not be {@literal null}.
|
||||
* @return the {@link Weights} for {@code weights}.
|
||||
*/
|
||||
public static Weights of(double... weights) {
|
||||
|
||||
Assert.notNull(weights, "Weights must not be null");
|
||||
|
||||
return new Weights(DoubleStream.of(weights).boxed().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates equal {@link Weights} for a number of input sets {@code count} with a weight of one.
|
||||
*
|
||||
* @param count number of input sets. Must be greater or equal to zero.
|
||||
* @return equal {@link Weights} for a number of input sets with a weight of one.
|
||||
*/
|
||||
public static Weights fromSetCount(int count) {
|
||||
|
||||
Assert.isTrue(count >= 0, "Count of input sorted sets must be greater or equal to zero");
|
||||
|
||||
return new Weights(IntStream.range(0, count).mapToDouble(value -> 1).boxed().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Weights} object that contains all weights multiplied by {@code multiplier}
|
||||
*
|
||||
* @param multiplier multiplier used to multiply each weight with.
|
||||
* @return equal {@link Weights} for a number of input sets with a weight of one.
|
||||
*/
|
||||
public Weights multiply(int multiplier) {
|
||||
return apply(it -> it * multiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Weights} object that contains all weights multiplied by {@code multiplier}
|
||||
*
|
||||
* @param multiplier multiplier used to multiply each weight with.
|
||||
* @return equal {@link Weights} for a number of input sets with a weight of one.
|
||||
*/
|
||||
public Weights multiply(double multiplier) {
|
||||
return apply(it -> it * multiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Weights} object that contains all weights with {@link Function} applied.
|
||||
*
|
||||
* @param operator operator function.
|
||||
* @return the new {@link Weights} with {@link DoubleUnaryOperator} applied.
|
||||
*/
|
||||
public Weights apply(Function<Double, Double> operator) {
|
||||
return new Weights(weights.stream().map(operator).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the weight at {@code index}.
|
||||
*
|
||||
* @param index the weight index.
|
||||
* @return the weight at {@code index}.
|
||||
* @throws IndexOutOfBoundsException if the index is out of range
|
||||
*/
|
||||
public double getWeight(int index) {
|
||||
return weights.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return number of weights.
|
||||
*/
|
||||
public int size() {
|
||||
return weights.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array containing all of the weights in this list in proper sequence (from first to last element).
|
||||
*/
|
||||
public double[] toArray() {
|
||||
return weights.stream().mapToDouble(Double::doubleValue).toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a {@link List} containing all of the weights in this list in proper sequence (from first to last element).
|
||||
*/
|
||||
public List<Double> toList() {
|
||||
return Collections.unmodifiableList(weights);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof Weights)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Weights that = (Weights) o;
|
||||
return ObjectUtils.nullSafeEquals(this.weights, that.weights);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(weights);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class DefaultTypedTuple<V> implements TypedTuple<V> {
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.springframework.data.redis.core.convert;
|
||||
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -75,7 +76,7 @@ public class GeoIndexedPropertyValue implements IndexedData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.core.convert;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -78,7 +79,7 @@ public class SimpleIndexedPropertyValue implements IndexedData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.redis.core.index;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -93,7 +94,7 @@ public interface IndexDefinition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class RedisIndexDefinition implements IndexDefinition {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.data.redis.core.index;
|
||||
|
||||
import org.springframework.data.redis.core.convert.SpelIndexResolver;
|
||||
import org.springframework.expression.spel.standard.SpelExpression;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,7 @@ public class SpelIndexDefinition extends RedisIndexDefinition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -252,7 +252,7 @@ public class RedisClientInfo {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.springframework.data.geo.Distance;
|
||||
import org.springframework.data.geo.Metric;
|
||||
import org.springframework.data.geo.Shape;
|
||||
import org.springframework.data.redis.connection.RedisGeoCommands;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -93,7 +94,7 @@ public class BoundingBox implements Shape {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.data.redis.domain.geo;
|
||||
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.redis.connection.RedisGeoCommands;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ public class GeoLocation<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.redis.domain.geo;
|
||||
import org.springframework.data.geo.Circle;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.redis.connection.RedisGeoCommands;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -128,7 +129,7 @@ public interface GeoReference<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
@@ -173,7 +174,7 @@ public interface GeoReference<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.listener;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class ChannelTopic implements Topic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.listener;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -70,7 +71,7 @@ public class PatternTopic implements Topic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o)
|
||||
return true;
|
||||
|
||||
@@ -125,7 +125,7 @@ public class RedisOperationChain {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StreamOperations;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -345,7 +346,7 @@ class DefaultStreamMessageListenerContainer<K, V extends Record<K, ?>> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
|
||||
@@ -183,7 +183,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (o == this)
|
||||
return true;
|
||||
|
||||
@@ -238,7 +238,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
|
||||
if (o == this)
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,8 @@ package org.springframework.data.redis;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple serializable class.
|
||||
*
|
||||
@@ -84,7 +86,7 @@ public class Address implements Serializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
|
||||
@@ -17,6 +17,8 @@ package org.springframework.data.redis;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple serializable class.
|
||||
*
|
||||
@@ -89,7 +91,7 @@ public class Person implements Serializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.data.redis.core.mapping.RedisMappingContext;
|
||||
import org.springframework.data.redis.test.extension.RedisStanalone;
|
||||
import org.springframework.data.redis.test.extension.parametrized.MethodSource;
|
||||
import org.springframework.data.redis.test.extension.parametrized.ParameterizedRedisTest;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -880,7 +881,7 @@ public class RedisKeyValueTemplateTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.redis.repository.cdi;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.redis.core.RedisHash;
|
||||
import org.springframework.data.redis.core.index.Indexed;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
@@ -46,7 +47,7 @@ class Person {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (!(o instanceof Person))
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GenericJackson2JsonRedisSerializer}.
|
||||
@@ -363,7 +364,7 @@ class GenericJackson2JsonRedisSerializerUnitTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
@@ -402,7 +403,7 @@ class GenericJackson2JsonRedisSerializerUnitTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user