DATAREDIS-1143 - Delombok source files.

Original pull request: #530.
This commit is contained in:
Christoph Strobl
2020-05-11 08:49:53 +02:00
committed by Mark Paluch
parent 67c4cc13cb
commit 51cba2bcb1
74 changed files with 1097 additions and 334 deletions

View File

@@ -15,11 +15,6 @@
*/
package org.springframework.data.redis.connection;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
@@ -657,14 +652,16 @@ public class ClusterCommandExecutor implements DisposableBean {
* @author Christoph Strobl
* @since 2.0.3
*/
@Getter
@EqualsAndHashCode
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
private static class PositionalKey {
private final ByteArrayWrapper key;
private final int position;
private PositionalKey(ByteArrayWrapper key, int position) {
this.key = key;
this.position = position;
}
static PositionalKey of(byte[] key, int index) {
return new PositionalKey(new ByteArrayWrapper(key), index);
}
@@ -675,6 +672,35 @@ public class ClusterCommandExecutor implements DisposableBean {
byte[] getBytes() {
return key.getArray();
}
public ByteArrayWrapper getKey() {
return this.key;
}
public int getPosition() {
return this.position;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
PositionalKey that = (PositionalKey) o;
if (position != that.position)
return false;
return ObjectUtils.nullSafeEquals(key, that.key);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(key);
result = 31 * result + position;
return result;
}
}
/**
@@ -684,11 +710,14 @@ public class ClusterCommandExecutor implements DisposableBean {
* @author Christoph Strobl
* @since 2.0.3
*/
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
private static class PositionalKeys implements Iterable<PositionalKey> {
private final List<PositionalKey> keys;
private PositionalKeys(List<PositionalKey> keys) {
this.keys = keys;
}
/**
* Create an empty {@link PositionalKeys}.
*/

View File

@@ -15,17 +15,15 @@
*/
package org.springframework.data.redis.connection;
import lombok.EqualsAndHashCode;
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
import org.springframework.util.ObjectUtils;
/**
* Default implementation for {@link StringTuple} interface.
*
* @author Costin Leau
*/
@EqualsAndHashCode(callSuper = true)
public class DefaultStringTuple extends DefaultTuple implements StringTuple {
private final String valueAsString;
@@ -60,4 +58,25 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
public String toString() {
return "DefaultStringTuple[value=" + getValueAsString() + ", score=" + getScore() + "]";
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
DefaultStringTuple that = (DefaultStringTuple) o;
return ObjectUtils.nullSafeEquals(valueAsString, that.valueAsString);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(valueAsString);
return result;
}
}

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.redis.connection;
import lombok.Data;
import reactor.core.publisher.Mono;
import java.io.Closeable;
@@ -27,6 +26,7 @@ import org.springframework.data.domain.Range.Bound;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Redis connection using reactive infrastructure declaring entry points for reactive command execution.
@@ -346,12 +346,16 @@ public interface ReactiveRedisConnection extends Closeable {
* @param <I> command input type.
* @param <O> command output type.
*/
@Data
class CommandResponse<I, O> {
private final I input;
private final @Nullable O output;
public CommandResponse(I input, O output) {
this.input = input;
this.output = output;
}
/**
* @return {@literal true} if the response is present. An absent {@link CommandResponse} maps to Redis
* {@literal (nil)}.
@@ -359,6 +363,41 @@ public interface ReactiveRedisConnection extends Closeable {
public boolean isPresent() {
return true;
}
public I getInput() {
return this.input;
}
@Nullable
public O getOutput() {
return this.output;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
CommandResponse<?, ?> that = (CommandResponse<?, ?>) o;
if (!ObjectUtils.nullSafeEquals(input, that.input)) {
return false;
}
return ObjectUtils.nullSafeEquals(output, that.output);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(input);
result = 31 * result + ObjectUtils.nullSafeHashCode(output);
return result;
}
public String toString() {
return "ReactiveRedisConnection.CommandResponse(input=" + this.getInput() + ", output=" + this.getOutput() + ")";
}
}
/**

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.redis.connection;
import lombok.EqualsAndHashCode;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -23,6 +22,7 @@ import java.nio.ByteBuffer;
import java.util.Set;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Subscription for Redis channels using reactive infrastructure. A {@link ReactiveSubscription} allows subscribing to
@@ -155,7 +155,6 @@ public interface ReactiveSubscription {
* @author Christoph Strobl
* @since 2.1
*/
@EqualsAndHashCode
class ChannelMessage<C, M> implements Message<C, M> {
private final C channel;
@@ -194,6 +193,28 @@ public interface ReactiveSubscription {
return message;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ChannelMessage<?, ?> that = (ChannelMessage<?, ?>) o;
if (!ObjectUtils.nullSafeEquals(channel, that.channel)) {
return false;
}
return ObjectUtils.nullSafeEquals(message, that.message);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(channel);
result = 31 * result + ObjectUtils.nullSafeHashCode(message);
return result;
}
@Override
public String toString() {
return "ChannelMessage {" + "channel=" + channel + ", message=" + message + '}';
@@ -210,7 +231,6 @@ public interface ReactiveSubscription {
* @author Christoph Strobl
* @since 2.1
*/
@EqualsAndHashCode(callSuper = true)
class PatternMessage<P, C, M> extends ChannelMessage<C, M> {
private final P pattern;
@@ -239,6 +259,27 @@ public interface ReactiveSubscription {
return pattern;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
PatternMessage<?, ?, ?> that = (PatternMessage<?, ?, ?>) o;
return ObjectUtils.nullSafeEquals(pattern, that.pattern);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(pattern);
return result;
}
@Override
public String toString() {
return "PatternMessage{" + "channel=" + getChannel() + ", pattern=" + pattern + ", message=" + getMessage() + '}';

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.connection;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -355,12 +352,60 @@ public interface RedisGeoCommands {
* @param <T>
* @since 1.8
*/
@Data
@RequiredArgsConstructor
class GeoLocation<T> {
private final T name;
private final Point point;
public GeoLocation(T name, Point point) {
this.name = name;
this.point = point;
}
public T getName() {
return this.name;
}
public Point getPoint() {
return this.point;
}
public boolean equals(final Object o) {
if (o == this)
return true;
if (!(o instanceof GeoLocation))
return false;
final GeoLocation<?> other = (GeoLocation<?>) o;
if (!other.canEqual((Object) this))
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;
}
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());
return result;
}
public String toString() {
return "RedisGeoCommands.GeoLocation(name=" + this.getName() + ", point=" + this.getPoint() + ")";
}
}
/**

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.data.redis.connection;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Optional;
@@ -40,14 +36,16 @@ import org.springframework.util.StringUtils;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@EqualsAndHashCode
public class RedisPassword {
private static final RedisPassword NONE = new RedisPassword(new char[] {});
private final char[] thePassword;
private RedisPassword(char[] thePassword) {
this.thePassword = thePassword;
}
/**
* Create a {@link RedisPassword} from a {@link String}.
*
@@ -148,4 +146,22 @@ public class RedisPassword {
public String toString() {
return String.format("%s[%s]", getClass().getSimpleName(), isPresent() ? "*****" : "<none>");
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RedisPassword password = (RedisPassword) o;
return ObjectUtils.nullSafeEquals(thePassword, password.thePassword);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(thePassword);
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.convert;
import lombok.RequiredArgsConstructor;
import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.ArrayList;
@@ -588,12 +586,15 @@ abstract public class Converters {
* @param <V>
* @since 1.8
*/
@RequiredArgsConstructor
static class DeserializingGeoResultsConverter<V>
implements Converter<GeoResults<GeoLocation<byte[]>>, GeoResults<GeoLocation<V>>> {
final RedisSerializer<V> serializer;
public DeserializingGeoResultsConverter(RedisSerializer<V> serializer) {
this.serializer = serializer;
}
/*
* (non-Javadoc)
* @see org.springframework.core.convert.converter.Converter#convert(Object)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoUnit;
import redis.clients.jedis.params.GeoRadiusParam;
@@ -39,10 +37,15 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterGeoCommands implements RedisGeoCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterGeoCommands(JedisClusterConnection connection) {
Assert.notNull(connection, "Connection must not be null!");
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import java.util.ArrayList;
@@ -40,10 +38,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterHashCommands implements RedisHashCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterHashCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.redis.connection.ClusterSlotHashUtil;
@@ -30,10 +27,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterHyperLogLogCommands implements RedisHyperLogLogCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterHyperLogLogCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.BinaryJedis;
import redis.clients.jedis.ScanParams;
@@ -57,10 +55,13 @@ import org.springframework.util.ObjectUtils;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterKeyCommands implements RedisKeyCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterKeyCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)
@@ -495,8 +496,7 @@ class JedisClusterKeyCommands implements RedisKeyCommands {
}
return JedisConverters.toString(this.connection.execute("RESTORE", key,
Arrays.asList(JedisConverters.toBytes(ttlInMillis), serializedValue, JedisConverters.toBytes
("REPLACE"))));
Arrays.asList(JedisConverters.toBytes(ttlInMillis), serializedValue, JedisConverters.toBytes("REPLACE"))));
}, connection.clusterGetNodeForKey(key));
}

View File

@@ -19,8 +19,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.ClusterSlotHashUtil;
import org.springframework.data.redis.connection.RedisListCommands;
@@ -33,10 +31,13 @@ import org.springframework.util.CollectionUtils;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterListCommands implements RedisListCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterListCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.BinaryJedis;
import redis.clients.jedis.JedisCluster;
@@ -33,10 +31,13 @@ import org.springframework.util.Assert;
* @author Pavel Khokhlov
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterScriptingCommands implements RedisScriptingCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterScriptingCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.BinaryJedis;
import redis.clients.jedis.Jedis;
@@ -44,10 +42,13 @@ import org.springframework.util.CollectionUtils;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterServerCommands implements RedisClusterServerCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterServerCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import java.util.ArrayList;
@@ -43,10 +41,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterSetCommands implements RedisSetCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterSetCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.BinaryJedis;
import redis.clients.jedis.Connection;
import redis.clients.jedis.params.SetParams;
@@ -45,10 +43,13 @@ import org.springframework.util.Assert;
* @author Xiaohu Zhang
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterStringCommands implements RedisStringCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterStringCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)
@@ -131,7 +132,8 @@ class JedisClusterStringCommands implements RedisStringCommands {
Assert.notNull(expiration, "Expiration must not be null!");
Assert.notNull(option, "Option must not be null!");
SetParams setParams = JedisConverters.toSetCommandExPxArgument(expiration, JedisConverters.toSetCommandNxXxArgument(option));
SetParams setParams = JedisConverters.toSetCommandExPxArgument(expiration,
JedisConverters.toSetCommandNxXxArgument(option));
try {
return Converters.stringToBoolean(connection.getCluster().set(key, value, setParams));

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ZParams;
@@ -39,10 +37,13 @@ import org.springframework.util.Assert;
* @author Clement Ong
* @since 2.0
*/
@RequiredArgsConstructor
class JedisClusterZSetCommands implements RedisZSetCommands {
private final @NonNull JedisClusterConnection connection;
private final JedisClusterConnection connection;
JedisClusterZSetCommands(JedisClusterConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoUnit;
@@ -39,10 +37,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisGeoCommands implements RedisGeoCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisGeoCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
@@ -38,10 +36,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisHashCommands implements RedisHashCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisHashCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.connection.RedisHyperLogLogCommands;
import org.springframework.util.Assert;
@@ -26,10 +23,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisHyperLogLogCommands implements RedisHyperLogLogCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisHyperLogLogCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.SortingParams;
@@ -43,10 +41,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisKeyCommands implements RedisKeyCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisKeyCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.Protocol;
import java.util.ArrayList;
@@ -30,10 +28,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisListCommands implements RedisListCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisListCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
import org.springframework.data.redis.connection.RedisScriptingCommands;
@@ -28,10 +25,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisScriptingCommands implements RedisScriptingCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisScriptingCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Properties;
@@ -33,12 +30,15 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisServerCommands implements RedisServerCommands {
private static final String SHUTDOWN_SCRIPT = "return redis.call('SHUTDOWN','%s')";
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisServerCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import java.util.ArrayList;
@@ -35,10 +33,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisSetCommands implements RedisSetCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisSetCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.BitPosParams;
import redis.clients.jedis.Client;
import redis.clients.jedis.params.SetParams;
@@ -38,10 +36,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisStringCommands implements RedisStringCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
JedisStringCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)
@@ -157,7 +158,8 @@ class JedisStringCommands implements RedisStringCommands {
Assert.notNull(expiration, "Expiration must not be null!");
Assert.notNull(option, "Option must not be null!");
SetParams params = JedisConverters.toSetCommandExPxArgument(expiration, JedisConverters.toSetCommandNxXxArgument(option));
SetParams params = JedisConverters.toSetCommandExPxArgument(expiration,
JedisConverters.toSetCommandNxXxArgument(option));
try {
if (isPipelined()) {

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.jedis;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
import redis.clients.jedis.ZParams;
@@ -38,10 +36,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class JedisZSetCommands implements RedisZSetCommands {
private final @NonNull JedisConnection connection;
private final JedisConnection connection;
public JedisZSetCommands(JedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -22,7 +22,6 @@ import io.lettuce.core.cluster.RedisClusterClient;
import io.lettuce.core.cluster.SlotHash;
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.RequiredArgsConstructor;
import java.time.Duration;
import java.util.ArrayList;
@@ -34,7 +33,6 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataAccessResourceFailureException;
@@ -666,12 +664,15 @@ public class LettuceClusterConnection extends LettuceConnection implements Defau
* @author Christoph Strobl
* @since 1.7
*/
@RequiredArgsConstructor
static class LettuceClusterNodeResourceProvider implements ClusterNodeResourceProvider, DisposableBean {
private final LettuceConnectionProvider connectionProvider;
private volatile @Nullable StatefulRedisClusterConnection<byte[], byte[]> connection;
LettuceClusterNodeResourceProvider(LettuceConnectionProvider connectionProvider) {
this.connectionProvider = connectionProvider;
}
@Override
@SuppressWarnings("unchecked")
public RedisClusterCommands<byte[], byte[]> getResourceForSpecificNode(RedisClusterNode node) {

View File

@@ -39,7 +39,6 @@ import io.lettuce.core.protocol.CommandArgs;
import io.lettuce.core.protocol.CommandType;
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
import io.lettuce.core.sentinel.api.StatefulRedisSentinelConnection;
import lombok.RequiredArgsConstructor;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
@@ -1308,11 +1307,14 @@ public class LettuceConnection extends AbstractRedisConnection {
}
}
@RequiredArgsConstructor
static class LettucePoolConnectionProvider implements LettuceConnectionProvider {
private final LettucePool pool;
LettucePoolConnectionProvider(LettucePool pool) {
this.pool = pool;
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.connection.lettuce.LettuceConnectionProvider#getConnection(java.lang.Class)
@@ -1437,8 +1439,9 @@ public class LettuceConnection extends AbstractRedisConnection {
/**
* Implementation to flush on each command.
* @author Mark Paluch
* @since 2.3
*
* @author Mark Paluch
* @since 2.3
*/
private enum FlushEachCommand implements PipeliningFlushPolicy, PipeliningFlushState {
@@ -1461,8 +1464,9 @@ public class LettuceConnection extends AbstractRedisConnection {
/**
* Implementation to flush on closing the pipeline.
* @author Mark Paluch
* @since 2.3
*
* @author Mark Paluch
* @since 2.3
*/
private enum FlushOnClose implements PipeliningFlushPolicy, PipeliningFlushState {
@@ -1492,8 +1496,9 @@ public class LettuceConnection extends AbstractRedisConnection {
/**
* Pipeline state for buffered flushing.
* @author Mark Paluch
* @since 2.3
*
* @author Mark Paluch
* @since 2.3
*/
private static class BufferedFlushing implements PipeliningFlushState {

View File

@@ -30,7 +30,6 @@ import io.lettuce.core.cluster.RedisClusterClient;
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
import io.lettuce.core.codec.RedisCodec;
import io.lettuce.core.resource.ClientResources;
import lombok.RequiredArgsConstructor;
import java.nio.ByteBuffer;
import java.time.Duration;
@@ -1181,7 +1180,6 @@ public class LettuceConnectionFactory
* @author Christoph Strobl
* @since 2.1
*/
@RequiredArgsConstructor
class SharedConnection<E> {
private final LettuceConnectionProvider connectionProvider;
@@ -1191,6 +1189,10 @@ public class LettuceConnectionFactory
private @Nullable StatefulConnection<E, E> connection;
SharedConnection(LettuceConnectionProvider connectionProvider) {
this.connectionProvider = connectionProvider;
}
/**
* Returns a valid Lettuce connection. Initializes and validates the connection if
* {@link #setValidateConnection(boolean) enabled}.

View File

@@ -20,8 +20,6 @@ import io.lettuce.core.GeoCoordinates;
import io.lettuce.core.GeoWithin;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.Collection;
@@ -48,10 +46,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceGeoCommands implements RedisGeoCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceGeoCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -19,8 +19,6 @@ import io.lettuce.core.MapScanCursor;
import io.lettuce.core.ScanArgs;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Map;
@@ -41,10 +39,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceHashCommands implements RedisHashCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceHashCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -18,8 +18,6 @@ package org.springframework.data.redis.connection.lettuce;
import io.lettuce.core.api.sync.RedisHLLCommands;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisHyperLogLogCommands;
@@ -30,10 +28,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceHyperLogLogCommands implements RedisHyperLogLogCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceHyperLogLogCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -22,8 +22,6 @@ import io.lettuce.core.ScanCursor;
import io.lettuce.core.SortArgs;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.time.Duration;
import java.util.List;
@@ -47,10 +45,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceKeyCommands implements RedisKeyCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceKeyCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -17,8 +17,6 @@ package org.springframework.data.redis.connection.lettuce;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
@@ -31,10 +29,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceListCommands implements RedisListCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceListCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -16,8 +16,6 @@
package org.springframework.data.redis.connection.lettuce;
import io.lettuce.core.pubsub.api.reactive.RedisPubSubReactiveCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -35,10 +33,13 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 2.1
*/
@RequiredArgsConstructor
class LettuceReactivePubSubCommands implements ReactivePubSubCommands {
private final @NonNull LettuceReactiveRedisConnection connection;
private final LettuceReactiveRedisConnection connection;
LettuceReactivePubSubCommands(LettuceReactiveRedisConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -16,7 +16,6 @@
package org.springframework.data.redis.connection.lettuce;
import io.lettuce.core.pubsub.api.reactive.RedisPubSubReactiveCommands;
import lombok.RequiredArgsConstructor;
import reactor.core.Disposable;
import reactor.core.publisher.ConnectableFlux;
import reactor.core.publisher.Flux;
@@ -186,7 +185,6 @@ class LettuceReactiveSubscription implements ReactiveSubscription {
*
* @author Mark Paluch
*/
@RequiredArgsConstructor
static class State {
private final Set<ByteBuffer> targets = new ConcurrentSkipListSet<>();
@@ -196,6 +194,10 @@ class LettuceReactiveSubscription implements ReactiveSubscription {
private volatile @Nullable Disposable disposable;
State(Function<Throwable, Throwable> exceptionTranslator) {
this.exceptionTranslator = exceptionTranslator;
}
/**
* Subscribe to {@code targets} using subscribe {@link Function} and register {@code targets} after subscription.
*

View File

@@ -17,8 +17,6 @@ package org.springframework.data.redis.connection.lettuce;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Properties;
@@ -35,10 +33,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceServerCommands implements RedisServerCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceServerCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -19,8 +19,6 @@ import io.lettuce.core.ScanArgs;
import io.lettuce.core.ValueScanCursor;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@@ -40,10 +38,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceSetCommands implements RedisSetCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceSetCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -21,8 +21,6 @@ import io.lettuce.core.XGroupCreateArgs;
import io.lettuce.core.XReadArgs;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import java.util.List;
@@ -51,10 +49,13 @@ import org.springframework.util.Assert;
* @author Tugdual Grall
* @since 2.2
*/
@RequiredArgsConstructor
class LettuceStreamCommands implements RedisStreamCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceStreamCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)

View File

@@ -19,8 +19,6 @@ import io.lettuce.core.BitFieldArgs;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Map;
@@ -40,10 +38,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceStringCommands implements RedisStringCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceStringCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)
@@ -727,8 +728,7 @@ class LettuceStringCommands implements RedisStringCommands {
if (isPipelined()) {
pipeline(this.connection.newLettuceResult(futureResult));
}
else if (isQueueing()) {
} else if (isQueueing()) {
transaction(this.connection.newLettuceResult(futureResult));
}
return null;

View File

@@ -21,8 +21,6 @@ import io.lettuce.core.ScoredValueScanCursor;
import io.lettuce.core.ZStoreArgs;
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Set;
@@ -41,10 +39,13 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @since 2.0
*/
@RequiredArgsConstructor
class LettuceZSetCommands implements RedisZSetCommands {
private final @NonNull LettuceConnection connection;
private final LettuceConnection connection;
LettuceZSetCommands(LettuceConnection connection) {
this.connection = connection;
}
/*
* (non-Javadoc)
@@ -843,12 +844,11 @@ class LettuceZSetCommands implements RedisZSetCommands {
if (limit.isUnlimited()) {
pipeline(
connection.newLettuceResult(getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range, true)),
LettuceConverters.bytesListToBytesSet()));
LettuceConverters.bytesListToBytesSet()));
} else {
pipeline(connection.newLettuceResult(
getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range, true),
LettuceConverters.toLimit(limit)),
LettuceConverters.bytesListToBytesSet()));
pipeline(
connection.newLettuceResult(getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range, true),
LettuceConverters.toLimit(limit)), LettuceConverters.bytesListToBytesSet()));
}
return null;
}
@@ -858,10 +858,9 @@ class LettuceZSetCommands implements RedisZSetCommands {
connection.newLettuceResult(getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range, true)),
LettuceConverters.bytesListToBytesSet()));
} else {
transaction(connection.newLettuceResult(
getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range, true),
LettuceConverters.toLimit(limit)),
LettuceConverters.bytesListToBytesSet()));
transaction(
connection.newLettuceResult(getAsyncConnection().zrangebylex(key, LettuceConverters.toRange(range, true),
LettuceConverters.toLimit(limit)), LettuceConverters.bytesListToBytesSet()));
}
return null;
}

View File

@@ -15,10 +15,8 @@
*/
package org.springframework.data.redis.connection.stream;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Value object representing a Stream consumer within a consumer group. Group name and consumer name are encoded as
@@ -27,8 +25,6 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @see 2.2
*/
@EqualsAndHashCode
@Getter
public class Consumer {
private final String group;
@@ -58,4 +54,34 @@ public class Consumer {
public String toString() {
return String.format("%s:%s", group, name);
}
public String getGroup() {
return this.group;
}
public String getName() {
return this.name;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Consumer consumer = (Consumer) o;
if (!ObjectUtils.nullSafeEquals(group, consumer.group)) {
return false;
}
return ObjectUtils.nullSafeEquals(name, consumer.name);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(group);
result = 31 * result + ObjectUtils.nullSafeHashCode(name);
return result;
}
}

View File

@@ -15,18 +15,12 @@
*/
package org.springframework.data.redis.connection.stream;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Value object representing read offset for a Stream.
*/
@EqualsAndHashCode
@ToString
@Getter
public final class ReadOffset {
private final String offset;
@@ -81,4 +75,30 @@ public final class ReadOffset {
return from(offset.getValue());
}
public String getOffset() {
return this.offset;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ReadOffset that = (ReadOffset) o;
return ObjectUtils.nullSafeEquals(offset, that.offset);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(offset);
}
public String toString() {
return "ReadOffset(offset=" + this.getOffset() + ")";
}
}

View File

@@ -15,11 +15,10 @@
*/
package org.springframework.data.redis.connection.stream;
import lombok.EqualsAndHashCode;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.NumberUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
@@ -30,7 +29,6 @@ import org.springframework.util.StringUtils;
* @since 2.2
* @see <a href="https://redis.io/topics/streams-intro#entry-ids">Redis Documentation - Entriy ID</a>
*/
@EqualsAndHashCode
public class RecordId {
private static final String GENERATE_ID = "*";
@@ -154,4 +152,21 @@ public class RecordId {
private Long value(int index) {
return NumberUtils.parseNumber(StringUtils.split(raw, DELIMITER)[index], Long.class);
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RecordId recordId = (RecordId) o;
return ObjectUtils.nullSafeEquals(raw, recordId.raw);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(raw);
}
}

View File

@@ -15,11 +15,8 @@
*/
package org.springframework.data.redis.connection.stream;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Value object representing a Stream Id with its offset.
@@ -27,9 +24,6 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @see 2.2
*/
@EqualsAndHashCode
@ToString
@Getter
public final class StreamOffset<K> {
private final K key;
@@ -92,4 +86,40 @@ public final class StreamOffset<K> {
return create(reference.getStream(), ReadOffset.from(reference.getId()));
}
public K getKey() {
return this.key;
}
public ReadOffset getOffset() {
return this.offset;
}
@Override
public String toString() {
return "StreamOffset{" + "key=" + key + ", offset=" + offset + '}';
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
StreamOffset<?> that = (StreamOffset<?>) o;
if (!ObjectUtils.nullSafeEquals(key, that.key)) {
return false;
}
return ObjectUtils.nullSafeEquals(offset, that.offset);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(key);
result = 31 * result + ObjectUtils.nullSafeHashCode(offset);
return result;
}
}

View File

@@ -15,14 +15,11 @@
*/
package org.springframework.data.redis.connection.stream;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import java.time.Duration;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Options for reading messages from a Redis Stream.
@@ -31,9 +28,6 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @see 2.2
*/
@EqualsAndHashCode
@ToString
@Getter
public class StreamReadOptions {
private static final StreamReadOptions EMPTY = new StreamReadOptions(null, null, false);
@@ -113,4 +107,49 @@ public class StreamReadOptions {
public boolean isBlocking() {
return getBlock() != null && getBlock() >= 0;
}
@Nullable
public Long getBlock() {
return block;
}
@Nullable
public Long getCount() {
return count;
}
public boolean isNoack() {
return noack;
}
@Override
public String toString() {
return "StreamReadOptions{" + "block=" + block + ", count=" + count + ", noack=" + noack + ", autoAcknowledge="
+ autoAcknowledge() + ", blocking=" + isBlocking() + '}';
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
StreamReadOptions that = (StreamReadOptions) o;
if (noack != that.noack)
return false;
if (!ObjectUtils.nullSafeEquals(block, that.block)) {
return false;
}
return ObjectUtils.nullSafeEquals(count, that.count);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(block);
result = 31 * result + ObjectUtils.nullSafeHashCode(count);
result = 31 * result + (noack ? 1 : 0);
return result;
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.connection.stream;
import lombok.EqualsAndHashCode;
import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.Map;
@@ -386,7 +384,6 @@ public class StreamRecords {
* @param <S>
* @param <V>
*/
@EqualsAndHashCode
static class ObjectBackedRecord<S, V> implements ObjectRecord<S, V> {
private @Nullable S stream;
@@ -431,5 +428,31 @@ public class StreamRecords {
public String toString() {
return "ObjectBackedRecord{" + "recordId=" + recordId + ", value=" + value + '}';
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ObjectBackedRecord<?, ?> that = (ObjectBackedRecord<?, ?>) o;
if (!ObjectUtils.nullSafeEquals(stream, that.stream)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(recordId, that.recordId)) {
return false;
}
return ObjectUtils.nullSafeEquals(value, that.value);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(stream);
result = 31 * result + ObjectUtils.nullSafeHashCode(recordId);
result = 31 * result + ObjectUtils.nullSafeHashCode(value);
return result;
}
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -46,11 +44,17 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveGeoOperations<K, V> implements ReactiveGeoOperations<K, V> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<K, V> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<K, V> serializationContext;
DefaultReactiveGeoOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<K, V> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -40,11 +38,17 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveHashOperations<H, HK, HV> implements ReactiveHashOperations<H, HK, HV> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<H, ?> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<H, ?> serializationContext;
DefaultReactiveHashOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<H, ?> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -35,11 +33,17 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveHyperLogLogOperations<K, V> implements ReactiveHyperLogLogOperations<K, V> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<K, V> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<K, V> serializationContext;
DefaultReactiveHyperLogLogOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<K, V> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/* (non-Javadoc)
* @see org.springframework.data.redis.core.ReactiveHyperLogLogOperations#add(java.lang.Object, java.lang.Object[])

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -41,11 +39,17 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveListOperations<K, V> implements ReactiveListOperations<K, V> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<K, V> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<K, V> serializationContext;
DefaultReactiveListOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<K, V> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/* (non-Javadoc)
* @see org.springframework.data.redis.core.ReactiveListOperations#range(java.lang.Object, long, long)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -40,11 +38,17 @@ import org.springframework.util.Assert;
* @author Roman Bezpalko
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveSetOperations<K, V> implements ReactiveSetOperations<K, V> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<K, V> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<K, V> serializationContext;
DefaultReactiveSetOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<K, V> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -45,11 +43,17 @@ import org.springframework.util.Assert;
* @author Jiahe Cai
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveValueOperations<K, V> implements ReactiveValueOperations<K, V> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<K, V> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<K, V> serializationContext;
DefaultReactiveValueOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<K, V> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/* (non-Javadoc)
* @see org.springframework.data.redis.core.ReactiveValueOperations#set(java.lang.Object, java.lang.Object)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -47,11 +45,17 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultReactiveZSetOperations<K, V> implements ReactiveZSetOperations<K, V> {
private final @NonNull ReactiveRedisTemplate<?, ?> template;
private final @NonNull RedisSerializationContext<K, V> serializationContext;
private final ReactiveRedisTemplate<?, ?> template;
private final RedisSerializationContext<K, V> serializationContext;
public DefaultReactiveZSetOperations(ReactiveRedisTemplate<?, ?> template,
RedisSerializationContext<K, V> serializationContext) {
this.template = template;
this.serializationContext = serializationContext;
}
/*
* (non-Javadoc)

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core;
import lombok.RequiredArgsConstructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -24,7 +22,6 @@ import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.cglib.proxy.MethodProxy;
import org.springframework.dao.DataAccessException;
@@ -306,13 +303,20 @@ public abstract class RedisConnectionUtils {
* @author Christoph Strobl
* @author Thomas Darimont
*/
@RequiredArgsConstructor
private static class RedisTransactionSynchronizer extends TransactionSynchronizationAdapter {
private final RedisConnectionHolder connHolder;
private final RedisConnection connection;
private final RedisConnectionFactory factory;
RedisTransactionSynchronizer(RedisConnectionHolder connHolder, RedisConnection connection,
RedisConnectionFactory factory) {
this.connHolder = connHolder;
this.connection = connection;
this.factory = factory;
}
@Override
public void afterCompletion(int status) {

View File

@@ -15,11 +15,6 @@
*/
package org.springframework.data.redis.core.convert;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NonNull;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
@@ -302,13 +297,19 @@ public class Bucket {
* @author Mark Paluch
* @since 2.1
*/
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public static class BucketPropertyPath {
private final @NonNull Bucket bucket;
private final Bucket bucket;
private final @Nullable String prefix;
private BucketPropertyPath(Bucket bucket, String prefix) {
Assert.notNull(bucket, "Bucket must not be null!");
this.bucket = bucket;
this.prefix = prefix;
}
/**
* Creates a top-level {@link BucketPropertyPath} given {@link Bucket}.
*
@@ -355,5 +356,14 @@ public class Bucket {
private String getPath(String key) {
return StringUtils.hasText(prefix) ? prefix + "." + key : key;
}
public Bucket getBucket() {
return this.bucket;
}
@Nullable
public String getPrefix() {
return this.prefix;
}
}
}

View File

@@ -17,21 +17,25 @@ package org.springframework.data.redis.core.convert;
import org.springframework.data.geo.Point;
import lombok.Data;
/**
* {@link IndexedData} implementation indicating storage of data within a Redis GEO structure.
*
* @author Christoph Strobl
* @since 1.8
*/
@Data
public class GeoIndexedPropertyValue implements IndexedData {
private final String keyspace;
private final String indexName;
private final Point value;
public GeoIndexedPropertyValue(String keyspace, String indexName, Point value) {
this.keyspace = keyspace;
this.indexName = indexName;
this.value = value;
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.convert.IndexedData#getIndexName()
@@ -64,4 +68,52 @@ public class GeoIndexedPropertyValue implements IndexedData {
sb.setCharAt(index, ':');
return sb.toString();
}
public Point getValue() {
return this.value;
}
public boolean equals(final Object o) {
if (o == this)
return true;
if (!(o instanceof GeoIndexedPropertyValue))
return false;
final GeoIndexedPropertyValue other = (GeoIndexedPropertyValue) o;
if (!other.canEqual((Object) this))
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))
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;
}
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());
return result;
}
public String toString() {
return "GeoIndexedPropertyValue(keyspace=" + this.getKeyspace() + ", indexName=" + this.getIndexName() + ", value="
+ this.getValue() + ")";
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.core.convert;
import lombok.RequiredArgsConstructor;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.core.index.GeoIndexDefinition;
import org.springframework.data.redis.core.index.IndexDefinition;
@@ -52,11 +50,14 @@ class IndexedDataFactoryProvider {
* @author Christoph Strobl
* @since 1.8
*/
@RequiredArgsConstructor
static class SimpleIndexedPropertyValueFactory implements IndexedDataFactory {
final SimpleIndexDefinition indexDefinition;
SimpleIndexedPropertyValueFactory(SimpleIndexDefinition indexDefinition) {
this.indexDefinition = indexDefinition;
}
public SimpleIndexedPropertyValue createIndexedDataFor(Object value) {
return new SimpleIndexedPropertyValue(indexDefinition.getKeyspace(), indexDefinition.getIndexName(),
@@ -68,11 +69,14 @@ class IndexedDataFactoryProvider {
* @author Christoph Strobl
* @since 1.8
*/
@RequiredArgsConstructor
static class GeoIndexedPropertyValueFactory implements IndexedDataFactory {
final GeoIndexDefinition indexDefinition;
public GeoIndexedPropertyValueFactory(GeoIndexDefinition indexDefinition) {
this.indexDefinition = indexDefinition;
}
public GeoIndexedPropertyValue createIndexedDataFor(Object value) {
return new GeoIndexedPropertyValue(indexDefinition.getKeyspace(), indexDefinition.getPath(),

View File

@@ -15,14 +15,18 @@
*/
package org.springframework.data.redis.core.convert;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.lang.reflect.Array;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -1031,13 +1035,19 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
* @author Christoph Strobl
* @author Mark Paluch
*/
@RequiredArgsConstructor
private class ConverterAwareParameterValueProvider implements PropertyValueProvider<RedisPersistentProperty> {
private final String path;
private final RedisData source;
private final ConversionService conversionService;
ConverterAwareParameterValueProvider(String path, RedisData source, ConversionService conversionService) {
this.path = path;
this.source = source;
this.conversionService = conversionService;
}
@Override
@SuppressWarnings("unchecked")
public <T> T getPropertyValue(RedisPersistentProperty property) {
@@ -1145,8 +1155,6 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
* @author Mark Paluch
* @since 1.8.10
*/
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public static class KeyspaceIdentifier {
public static final String PHANTOM = "phantom";
@@ -1157,6 +1165,13 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
private String id;
private boolean phantomKey;
private KeyspaceIdentifier(String keyspace, String id, boolean phantomKey) {
this.keyspace = keyspace;
this.id = id;
this.phantomKey = phantomKey;
}
/**
* Parse a {@code key} into {@link KeyspaceIdentifier}.
*
@@ -1198,6 +1213,18 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
return keyspaceEndIndex > 0 && key.length() > keyspaceEndIndex;
}
public String getKeyspace() {
return this.keyspace;
}
public String getId() {
return this.id;
}
public boolean isPhantomKey() {
return this.phantomKey;
}
}
/**
@@ -1207,8 +1234,6 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
* @author Mark Paluch
* @since 1.8.10
*/
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public static class BinaryKeyspaceIdentifier {
public static final byte[] PHANTOM = KeyspaceIdentifier.PHANTOM.getBytes();
@@ -1219,6 +1244,13 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
private byte[] id;
private boolean phantomKey;
private BinaryKeyspaceIdentifier(byte[] keyspace, byte[] id, boolean phantomKey) {
this.keyspace = keyspace;
this.id = id;
this.phantomKey = phantomKey;
}
/**
* Parse a binary {@code key} into {@link BinaryKeyspaceIdentifier}.
*
@@ -1280,5 +1312,17 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
return keyspace;
}
public byte[] getKeyspace() {
return this.keyspace;
}
public byte[] getId() {
return this.id;
}
public boolean isPhantomKey() {
return this.phantomKey;
}
}
}

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.redis.core.convert;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.util.ObjectUtils;
/**
* {@link IndexedData} implementation indicating storage of data within a Redis Set.
@@ -25,8 +24,6 @@ import lombok.ToString;
* @author Rob Winch
* @since 1.7
*/
@EqualsAndHashCode
@ToString
public class SimpleIndexedPropertyValue implements IndexedData {
private final String keyspace;
@@ -73,4 +70,36 @@ public class SimpleIndexedPropertyValue implements IndexedData {
public String getKeyspace() {
return this.keyspace;
}
@Override
public String toString() {
return "SimpleIndexedPropertyValue{" + "keyspace='" + keyspace + '\'' + ", indexName='" + indexName + '\''
+ ", value=" + value + '}';
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
SimpleIndexedPropertyValue that = (SimpleIndexedPropertyValue) o;
if (!ObjectUtils.nullSafeEquals(keyspace, that.keyspace)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(indexName, that.indexName)) {
return false;
}
return ObjectUtils.nullSafeEquals(value, that.value);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(keyspace);
result = 31 * result + ObjectUtils.nullSafeHashCode(indexName);
result = 31 * result + ObjectUtils.nullSafeHashCode(value);
return result;
}
}

View File

@@ -15,11 +15,10 @@
*/
package org.springframework.data.redis.core.index;
import lombok.Value;
import java.util.Collection;
import org.springframework.data.util.TypeInformation;
import org.springframework.util.ObjectUtils;
/**
* {@link IndexDefinition} allow to set up a blueprint for creating secondary index structures in Redis. Setting up
@@ -68,11 +67,60 @@ public interface IndexDefinition {
* @author Christoph Strobl
* @since 1.7
*/
@Value
public class IndexingContext {
final class IndexingContext {
private final String keyspace;
private final String path;
private final TypeInformation<?> typeInformation;
public IndexingContext(String keyspace, String path, TypeInformation<?> typeInformation) {
this.keyspace = keyspace;
this.path = path;
this.typeInformation = typeInformation;
}
public String getKeyspace() {
return this.keyspace;
}
public String getPath() {
return this.path;
}
public TypeInformation<?> getTypeInformation() {
return this.typeInformation;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
IndexingContext that = (IndexingContext) o;
if (!ObjectUtils.nullSafeEquals(keyspace, that.keyspace)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(path, that.path)) {
return false;
}
return ObjectUtils.nullSafeEquals(typeInformation, that.typeInformation);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(keyspace);
result = 31 * result + ObjectUtils.nullSafeHashCode(path);
result = 31 * result + ObjectUtils.nullSafeHashCode(typeInformation);
return result;
}
public String toString() {
return "IndexDefinition.IndexingContext(keyspace=" + this.getKeyspace() + ", path=" + this.getPath()
+ ", typeInformation=" + this.getTypeInformation() + ")";
}
}
}

View File

@@ -15,10 +15,9 @@
*/
package org.springframework.data.redis.core.index;
import lombok.EqualsAndHashCode;
import org.springframework.data.redis.core.convert.SpelIndexResolver;
import org.springframework.expression.spel.standard.SpelExpression;
import org.springframework.util.ObjectUtils;
/**
* {@link SpelIndexDefinition} defines index that is evaluated based on a {@link SpelExpression} requires the
@@ -27,7 +26,6 @@ import org.springframework.expression.spel.standard.SpelExpression;
* @author Christoph Strobl
* @since 1.7
*/
@EqualsAndHashCode(callSuper = true)
public class SpelIndexDefinition extends RedisIndexDefinition {
private final String expression;
@@ -55,4 +53,24 @@ public class SpelIndexDefinition extends RedisIndexDefinition {
return expression;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
SpelIndexDefinition that = (SpelIndexDefinition) o;
return ObjectUtils.nullSafeEquals(expression, that.expression);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(expression);
return result;
}
}

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.core.query;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.List;
import org.springframework.data.redis.connection.SortParameters.Order;
@@ -30,8 +27,6 @@ import org.springframework.lang.Nullable;
* @author Costin Leau
* @author Mark Paluch
*/
@Getter
@RequiredArgsConstructor
class DefaultSortQuery<K> implements SortQuery<K> {
private final K key;
@@ -41,10 +36,54 @@ class DefaultSortQuery<K> implements SortQuery<K> {
private final @Nullable String by;
private final List<String> getPattern;
DefaultSortQuery(K key, Order order, Boolean alpha, Range limit, String by, List<String> getPattern) {
this.key = key;
this.order = order;
this.alpha = alpha;
this.limit = limit;
this.by = by;
this.getPattern = getPattern;
}
@Override
public Boolean isAlphabetic() {
return alpha;
}
@Override
public K getKey() {
return this.key;
}
@Nullable
@Override
public Order getOrder() {
return this.order;
}
@Nullable
public Boolean getAlpha() {
return this.alpha;
}
@Nullable
@Override
public Range getLimit() {
return this.limit;
}
@Nullable
@Override
public String getBy() {
return this.by;
}
@Override
public List<String> getGetPattern() {
return this.getPattern;
}
@Override
public String toString() {
return "DefaultSortQuery [alpha=" + alpha + ", by=" + by + ", gets=" + getPattern + ", key=" + key + ", limit="
+ limit + ", order=" + order + "]";

View File

@@ -15,14 +15,13 @@
*/
package org.springframework.data.redis.core.types;
import lombok.EqualsAndHashCode;
import java.io.IOException;
import java.io.StringReader;
import java.util.Properties;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* {@link RedisClientInfo} provides general and statistical information about client connections.
@@ -30,7 +29,6 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @since 1.3
*/
@EqualsAndHashCode
public class RedisClientInfo {
public enum INFO {
@@ -253,6 +251,24 @@ public class RedisClientInfo {
return this.clientProperties.toString();
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
RedisClientInfo that = (RedisClientInfo) o;
return ObjectUtils.nullSafeEquals(clientProperties, that.clientProperties);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(clientProperties);
}
public static class RedisClientInfoBuilder {
public static RedisClientInfo fromString(String source) {

View File

@@ -15,9 +15,8 @@
*/
package org.springframework.data.redis.listener;
import lombok.EqualsAndHashCode;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Channel topic implementation (maps to a Redis channel).
@@ -25,7 +24,6 @@ import org.springframework.util.Assert;
* @author Costin Leau
* @author Mark Paluch
*/
@EqualsAndHashCode
public class ChannelTopic implements Topic {
private final String channelName;
@@ -69,4 +67,22 @@ public class ChannelTopic implements Topic {
public String toString() {
return channelName;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ChannelTopic that = (ChannelTopic) o;
return ObjectUtils.nullSafeEquals(channelName, that.channelName);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(channelName);
}
}

View File

@@ -15,9 +15,8 @@
*/
package org.springframework.data.redis.listener;
import lombok.EqualsAndHashCode;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Pattern topic (matching multiple channels).
@@ -26,7 +25,6 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @author Christoph Strobl
*/
@EqualsAndHashCode
public class PatternTopic implements Topic {
private final String channelPattern;
@@ -70,4 +68,22 @@ public class PatternTopic implements Topic {
public String toString() {
return channelPattern;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
PatternTopic that = (PatternTopic) o;
return ObjectUtils.nullSafeEquals(channelPattern, that.channelPattern);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(channelPattern);
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.repository.query;
import lombok.EqualsAndHashCode;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -28,6 +26,7 @@ import org.springframework.data.geo.Distance;
import org.springframework.data.geo.Point;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Simple set of operations required to run queries against Redis.
@@ -86,7 +85,6 @@ public class RedisOperationChain {
return near;
}
@EqualsAndHashCode
public static class PathAndValue {
private final String path;
@@ -125,6 +123,27 @@ public class RedisOperationChain {
public String toString() {
return path + ":" + (isSingleValue() ? getFirstValue() : values);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PathAndValue that = (PathAndValue) o;
if (!ObjectUtils.nullSafeEquals(path, that.path)) {
return false;
}
return ObjectUtils.nullSafeEquals(values, that.values);
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(path);
result = 31 * result + ObjectUtils.nullSafeHashCode(values);
return result;
}
}
/**

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.serializer;
import lombok.RequiredArgsConstructor;
import java.nio.ByteBuffer;
import org.springframework.data.redis.util.ByteUtils;
@@ -29,11 +27,14 @@ import org.springframework.lang.Nullable;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultRedisElementReader<T> implements RedisElementReader<T> {
private final @Nullable RedisSerializer<T> serializer;
DefaultRedisElementReader(RedisSerializer<T> serializer) {
this.serializer = serializer;
}
/* (non-Javadoc)
* @see org.springframework.data.redis.serializer.RedisElementReader#read(java.nio.ByteBuffer)
*/

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.serializer;
import lombok.RequiredArgsConstructor;
import java.nio.ByteBuffer;
import org.springframework.lang.Nullable;
@@ -28,11 +26,14 @@ import org.springframework.lang.Nullable;
* @author Christoph Strobl
* @since 2.0
*/
@RequiredArgsConstructor
class DefaultRedisElementWriter<T> implements RedisElementWriter<T> {
private final @Nullable RedisSerializer<T> serializer;
DefaultRedisElementWriter(RedisSerializer<T> serializer) {
this.serializer = serializer;
}
/* (non-Javadoc)
* @see org.springframework.data.redis.serializer.RedisElementWriter#write(java.lang.Object)
*/
@@ -51,7 +52,8 @@ class DefaultRedisElementWriter<T> implements RedisElementWriter<T> {
return (ByteBuffer) value;
}
throw new IllegalStateException(String.format("Cannot serialize value of type %s without a serializer", value.getClass()));
throw new IllegalStateException(
String.format("Cannot serialize value of type %s without a serializer", value.getClass()));
}
}

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.serializer;
import lombok.Getter;
import org.springframework.data.redis.serializer.RedisSerializationContext.SerializationPair;
/**
@@ -26,7 +24,6 @@ import org.springframework.data.redis.serializer.RedisSerializationContext.Seria
* @author Christoph Strobl
* @since 2.0
*/
@Getter
class DefaultSerializationPair<T> implements SerializationPair<T> {
private final RedisElementReader<T> reader;
@@ -38,4 +35,14 @@ class DefaultSerializationPair<T> implements SerializationPair<T> {
this.reader = (RedisElementReader) reader;
this.writer = (RedisElementWriter) writer;
}
@Override
public RedisElementReader<T> getReader() {
return this.reader;
}
@Override
public RedisElementWriter<T> getWriter() {
return this.writer;
}
}

View File

@@ -15,9 +15,6 @@
*/
package org.springframework.data.redis.stream;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
@@ -37,6 +34,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StreamOperations;
import org.springframework.util.Assert;
import org.springframework.util.ErrorHandler;
import org.springframework.util.ObjectUtils;
/**
* Simple {@link Executor} based {@link StreamMessageListenerContainer} implementation for running {@link Task tasks} to
@@ -286,12 +284,14 @@ class DefaultStreamMessageListenerContainer<K, V extends Record<K, ?>> implement
* @author Mark Paluch
* @since 2.2
*/
@EqualsAndHashCode
@RequiredArgsConstructor
static class TaskSubscription implements Subscription {
private final Task task;
protected TaskSubscription(Task task) {
this.task = task;
}
Task getTask() {
return task;
}
@@ -322,6 +322,23 @@ class DefaultStreamMessageListenerContainer<K, V extends Record<K, ?>> implement
public void cancel() throws DataAccessResourceFailureException {
task.cancel();
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
TaskSubscription that = (TaskSubscription) o;
return ObjectUtils.nullSafeEquals(task, that.task);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(task);
}
}
/**

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.data.redis.stream;
import lombok.RequiredArgsConstructor;
import reactor.core.CoreSubscriber;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
@@ -182,7 +181,6 @@ class DefaultStreamReceiver<K, V extends Record<K, ?>> implements StreamReceiver
/**
* A stateful Redis Stream subscription.
*/
@RequiredArgsConstructor
class StreamSubscription {
private final Queue<V> overflow = Queues.<V> small().get();
@@ -192,6 +190,15 @@ class DefaultStreamReceiver<K, V extends Record<K, ?>> implements StreamReceiver
private final PollState pollState;
private final BiFunction<K, ReadOffset, Flux<V>> readFunction;
protected StreamSubscription(FluxSink<V> sink, K key, PollState pollState,
BiFunction<K, ReadOffset, Flux<V>> readFunction) {
this.sink = sink;
this.key = key;
this.pollState = pollState;
this.readFunction = readFunction;
}
/**
* Arm the subscription so {@link Subscription#request(long) demand} activates polling.
*/

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.redis.support.atomic;
import lombok.RequiredArgsConstructor;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.function.Supplier;
@@ -39,7 +37,6 @@ import org.springframework.util.CollectionUtils;
* @see RedisAtomicInteger
* @see RedisAtomicLong
*/
@RequiredArgsConstructor
class CompareAndSet<T> implements SessionCallback<Boolean> {
private final Supplier<T> getter;
@@ -48,6 +45,15 @@ class CompareAndSet<T> implements SessionCallback<Boolean> {
private final T expect;
private final T update;
CompareAndSet(Supplier<T> getter, Consumer<T> setter, Object key, T expect, T update) {
this.getter = getter;
this.setter = setter;
this.key = key;
this.expect = expect;
this.update = update;
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.SessionCallback#execute(org.springframework.data.redis.core.RedisOperations)