Refine methods accepting floating-point Range values.

For easier usage we now use Range<? extends Number> instead of Range<Number> to allow Range<Double> usage.

Original pull request: #2370.
Closes #2421
This commit is contained in:
Mark Paluch
2022-09-23 15:24:16 +02:00
parent 62932e2b47
commit d94e9e87bd
14 changed files with 125 additions and 99 deletions

View File

@@ -992,7 +992,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Long zCount(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zCount(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return convertAndReturn(delegate.zCount(key, range), Converters.identityConverter());
}
@@ -1102,18 +1102,18 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return convertAndReturn(delegate.zRangeByScore(key, range), Converters.identityConverter());
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeByScore(key, range, limit), Converters.identityConverter());
}
@Override
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return convertAndReturn(delegate.zRangeByScoreWithScores(key, range), Converters.identityConverter());
}
@@ -1129,7 +1129,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeByScoreWithScores(key, range, limit), Converters.identityConverter());
}
@@ -1150,7 +1150,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return convertAndReturn(delegate.zRevRangeByScore(key, range), Converters.identityConverter());
}
@@ -1160,7 +1160,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRevRangeByScore(key, range, limit), Converters.identityConverter());
}
@@ -1172,12 +1172,14 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range) {
return convertAndReturn(delegate.zRevRangeByScoreWithScores(key, range), Converters.identityConverter());
}
@Override
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRevRangeByScoreWithScores(key, range, limit), Converters.identityConverter());
}
@@ -1213,7 +1215,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
}
@Override
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return convertAndReturn(delegate.zRemRangeByScore(key, range), Converters.identityConverter());
}
@@ -2747,28 +2749,31 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco
@Override
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<Number> range,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeStoreByScore(dstKey, srcKey, range, limit),
Converters.identityConverter());
}
@Override
public Long zRangeStoreByScore(String dstKey, String srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreByScore(String dstKey, String srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeStoreByScore(serialize(dstKey), serialize(srcKey), range, limit),
Converters.identityConverter());
}
@Override
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeStoreRevByScore(dstKey, srcKey, range, limit),
Converters.identityConverter());
}
@Override
public Long zRangeStoreRevByScore(String dstKey, String srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreRevByScore(String dstKey, String srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeStoreRevByScore(serialize(dstKey), serialize(srcKey), range, limit),
Converters.identityConverter());

View File

@@ -1018,7 +1018,7 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Long zCount(byte[] key, org.springframework.data.domain.Range<Number> range) {
default Long zCount(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return zSetCommands().zCount(key, range);
}
@@ -1160,7 +1160,7 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
default Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeByScore(key, range, limit);
}
@@ -1168,7 +1168,7 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
default Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeByScoreWithScores(key, range, limit);
}
@@ -1183,7 +1183,7 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
default Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRevRangeByScore(key, range, limit);
}
@@ -1191,7 +1191,8 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
default Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRevRangeByScoreWithScores(key, range, limit);
}
@@ -1227,7 +1228,7 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
default Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return zSetCommands().zRemRangeByScore(key, range);
}
@@ -1858,7 +1859,7 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
@Override
@Deprecated
default Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<Number> range,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeStoreByScore(dstKey, srcKey, range, limit);
}
@@ -1866,7 +1867,8 @@ public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsPr
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
default Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
default Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeStoreRevByScore(dstKey, srcKey, range, limit);
}

View File

@@ -569,7 +569,8 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
*/
@Nullable
default Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range) {
default Set<Tuple> zRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range) {
return zRangeByScoreWithScores(key, range, Limit.unlimited());
}
@@ -641,7 +642,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
*/
@Nullable
Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
/**
@@ -697,7 +698,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
*/
@Nullable
default Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
default Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return zRevRangeByScore(key, range, Limit.unlimited());
}
@@ -748,7 +749,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
*/
@Nullable
Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
/**
@@ -782,7 +783,8 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
*/
@Nullable
default Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range) {
default Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range) {
return zRevRangeByScoreWithScores(key, range, Limit.unlimited());
}
@@ -798,7 +800,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrevrangebyscore">Redis Documentation: ZREVRANGEBYSCORE</a>
*/
@Nullable
Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
/**
@@ -825,7 +827,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zcount">Redis Documentation: ZCOUNT</a>
*/
@Nullable
Long zCount(byte[] key, org.springframework.data.domain.Range<Number> range);
Long zCount(byte[] key, org.springframework.data.domain.Range<? extends Number> range);
/**
* Count number of elements within sorted set with value between {@code Range#min} and {@code Range#max} applying
@@ -994,7 +996,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zremrangebyscore">Redis Documentation: ZREMRANGEBYSCORE</a>
*/
@Nullable
Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range);
Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range);
/**
* Diff sorted {@code sets}.
@@ -1247,7 +1249,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
*/
@Nullable
default Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
default Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
return zRangeByScore(key, range, Limit.unlimited());
}
@@ -1279,7 +1281,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangebyscore">Redis Documentation: ZRANGEBYSCORE</a>
*/
@Nullable
Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
/**
@@ -1439,7 +1441,8 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
default Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range) {
default Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range) {
return zRangeStoreByScore(dstKey, srcKey, range, org.springframework.data.redis.connection.Limit.unlimited());
}
@@ -1455,7 +1458,7 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
/**
@@ -1470,7 +1473,7 @@ public interface RedisZSetCommands {
*/
@Nullable
default Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<Number> range) {
org.springframework.data.domain.Range<? extends Number> range) {
return zRangeStoreRevByScore(dstKey, srcKey, range, org.springframework.data.redis.connection.Limit.unlimited());
}
@@ -1486,7 +1489,8 @@ public interface RedisZSetCommands {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
}

View File

@@ -2059,7 +2059,8 @@ public interface StringRedisConnection extends RedisConnection {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
default Long zRangeStoreByScore(String dstKey, String srcKey, org.springframework.data.domain.Range<Number> range) {
default Long zRangeStoreByScore(String dstKey, String srcKey,
org.springframework.data.domain.Range<? extends Number> range) {
return zRangeStoreByScore(dstKey, srcKey, range, org.springframework.data.redis.connection.Limit.unlimited());
}
@@ -2075,7 +2076,7 @@ public interface StringRedisConnection extends RedisConnection {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long zRangeStoreByScore(String dstKey, String srcKey, org.springframework.data.domain.Range<Number> range,
Long zRangeStoreByScore(String dstKey, String srcKey, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
/**
@@ -2090,7 +2091,7 @@ public interface StringRedisConnection extends RedisConnection {
*/
@Nullable
default Long zRangeStoreRevByScore(String dstKey, String srcKey,
org.springframework.data.domain.Range<Number> range) {
org.springframework.data.domain.Range<? extends Number> range) {
return zRangeStoreRevByScore(dstKey, srcKey, range, org.springframework.data.redis.connection.Limit.unlimited());
}
@@ -2106,7 +2107,8 @@ public interface StringRedisConnection extends RedisConnection {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long zRangeStoreRevByScore(String dstKey, String srcKey, org.springframework.data.domain.Range<Number> range,
Long zRangeStoreRevByScore(String dstKey, String srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit);
// -------------------------------------------------------------------------

View File

@@ -210,7 +210,7 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
@Override
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -233,7 +233,7 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
@Override
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -256,7 +256,8 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
@Override
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -279,7 +280,7 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
@Override
public Long zCount(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zCount(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(range, "Range cannot be null for ZCOUNT");
@@ -395,7 +396,7 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
@Override
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(range, "Range cannot be null for ZREMRANGEBYSCORE");
@@ -414,7 +415,7 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -538,19 +539,22 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
@Nullable
@Override
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zRangeStoreByScore(dstKey, srcKey, range, limit, false);
}
@Nullable
@Override
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zRangeStoreByScore(dstKey, srcKey, range, limit, true);
}
private Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
private Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit, boolean rev) {
Assert.notNull(dstKey, "Destination key must not be null");

View File

@@ -175,7 +175,7 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -217,7 +217,7 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -239,7 +239,8 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -271,7 +272,7 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Long zCount(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zCount(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(range, "Range must not be null");
@@ -405,7 +406,7 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(range, "Range for ZREMRANGEBYSCORE must not be null");
@@ -619,7 +620,7 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -709,18 +710,21 @@ class JedisZSetCommands implements RedisZSetCommands {
}
@Override
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zRangeStoreByScore(dstKey, srcKey, range, limit, false);
}
@Override
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
return zRangeStoreByScore(dstKey, srcKey, range, limit, true);
}
private Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
private Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit, boolean rev) {
Assert.notNull(dstKey, "Destination key must not be null");

View File

@@ -278,7 +278,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
if (ObjectUtils.nullSafeEquals(command.getDirection(), Direction.ASC)) {
Range<Number> range = RangeConverter.toRange(command.getRange());
Range<? extends Number> range = RangeConverter.toRange(command.getRange());
if (command.isWithScores()) {
@@ -301,7 +301,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
}
} else {
Range<Number> range = RangeConverter.toRange(command.getRange());
Range<? extends Number> range = RangeConverter.toRange(command.getRange());
if (command.isWithScores()) {
@@ -351,7 +351,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
Assert.notNull(command.getKey(), "Key must not be null");
Assert.notNull(command.getRange(), "Range must not be null");
Range<Number> range = RangeConverter.toRange(command.getRange());
Range<? extends Number> range = RangeConverter.toRange(command.getRange());
Mono<Long> result = cmd.zcount(command.getKey(), range);
return result.map(value -> new NumericResponse<>(command, value));
@@ -483,7 +483,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands {
Assert.notNull(command.getKey(), "Key must not be null");
Assert.notNull(command.getRange(), "Range must not be null");
Range<Number> range = RangeConverter.toRange(command.getRange());
Range<? extends Number> range = RangeConverter.toRange(command.getRange());
Mono<Long> result = cmd.zremrangebyscore(command.getKey(), range);
return result.map(value -> new NumericResponse<>(command, value));

View File

@@ -166,7 +166,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -203,7 +203,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRevRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -222,7 +222,8 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -241,7 +242,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Long zCount(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zCount(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
Assert.notNull(key, "Key must not be null");
@@ -379,7 +380,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range) {
public Long zRemRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(range, "Range for ZREMRANGEBYSCORE must not be null");
@@ -588,7 +589,7 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<Number> range,
public Set<byte[]> zRangeByScore(byte[] key, org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(key, "Key must not be null");
@@ -665,7 +666,8 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(dstKey, "Destination key must not be null");
@@ -678,7 +680,8 @@ class LettuceZSetCommands implements RedisZSetCommands {
}
@Override
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range<Number> range,
public Long zRangeStoreRevByScore(byte[] dstKey, byte[] srcKey,
org.springframework.data.domain.Range<? extends Number> range,
org.springframework.data.redis.connection.Limit limit) {
Assert.notNull(dstKey, "Destination key must not be null");

View File

@@ -1040,7 +1040,7 @@ public interface BoundZSetOperations<K, V> extends BoundKeyOperations<K> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
default Long rangeAndStoreByScore(K dstKey, Range<Number> range) {
default Long rangeAndStoreByScore(K dstKey, Range<? extends Number> range) {
return rangeAndStoreByScore(dstKey, range, Limit.unlimited());
}
@@ -1058,7 +1058,7 @@ public interface BoundZSetOperations<K, V> extends BoundKeyOperations<K> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long rangeAndStoreByScore(K dstKey, Range<Number> range, Limit limit);
Long rangeAndStoreByScore(K dstKey, Range<? extends Number> range, Limit limit);
/**
* Store all elements at {@code dstKey} with reverse ordering by score from {@literal ZSET} at the bound key with a
@@ -1072,7 +1072,7 @@ public interface BoundZSetOperations<K, V> extends BoundKeyOperations<K> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
default Long reverseRangeAndStoreByScore(K dstKey, Range<Number> range) {
default Long reverseRangeAndStoreByScore(K dstKey, Range<? extends Number> range) {
return reverseRangeAndStoreByScore(dstKey, range, Limit.unlimited());
}
@@ -1089,7 +1089,7 @@ public interface BoundZSetOperations<K, V> extends BoundKeyOperations<K> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long reverseRangeAndStoreByScore(K dstKey, Range<Number> range, Limit limit);
Long reverseRangeAndStoreByScore(K dstKey, Range<? extends Number> range, Limit limit);
/**
* @return never {@literal null}.

View File

@@ -242,14 +242,14 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
}
@Override
public Long rangeAndStoreByScore(K srcKey, K dstKey, Range<Number> range, Limit limit) {
public Long rangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range, Limit limit) {
byte[] rawDstKey = rawKey(dstKey);
byte[] rawSrcKey = rawKey(srcKey);
return execute(connection -> connection.zRangeStoreByScore(rawDstKey, rawSrcKey, range, limit));
}
@Override
public Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<Number> range, Limit limit) {
public Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range, Limit limit) {
byte[] rawDstKey = rawKey(dstKey);
byte[] rawSrcKey = rawKey(srcKey);
return execute(connection -> connection.zRangeStoreRevByScore(rawDstKey, rawSrcKey, range, limit));

View File

@@ -1212,7 +1212,7 @@ public interface ZSetOperations<K, V> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
default Long rangeAndStoreByScore(K srcKey, K dstKey, Range<Number> range) {
default Long rangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range) {
return rangeAndStoreByScore(srcKey, dstKey, range, Limit.unlimited());
}
@@ -1231,7 +1231,7 @@ public interface ZSetOperations<K, V> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long rangeAndStoreByScore(K srcKey, K dstKey, Range<Number> range, Limit limit);
Long rangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range, Limit limit);
/**
* Store all elements at {@code dstKey} with reverse ordering by score from {@literal ZSET} at {@code srcKey} with a
@@ -1246,7 +1246,7 @@ public interface ZSetOperations<K, V> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
default Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<Number> range) {
default Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range) {
return reverseRangeAndStoreByScore(srcKey, dstKey, range, Limit.unlimited());
}
@@ -1265,7 +1265,7 @@ public interface ZSetOperations<K, V> {
* @see <a href="https://redis.io/commands/zrangestore">Redis Documentation: ZRANGESTORE</a>
*/
@Nullable
Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<Number> range, Limit limit);
Long reverseRangeAndStoreByScore(K srcKey, K dstKey, Range<? extends Number> range, Limit limit);
/**
* @return never {@literal null}.

View File

@@ -273,13 +273,13 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
}
@Override
public RedisZSet<E> rangeAndStoreByScore(String dstKey, Range<Number> range, Limit limit) {
public RedisZSet<E> rangeAndStoreByScore(String dstKey, Range<? extends Number> range, Limit limit) {
boundZSetOps.rangeAndStoreByScore(dstKey, range, limit);
return new DefaultRedisZSet<>(getOperations().boundZSetOps(dstKey));
}
@Override
public RedisZSet<E> reverseRangeAndStoreByScore(String dstKey, Range<Number> range, Limit limit) {
public RedisZSet<E> reverseRangeAndStoreByScore(String dstKey, Range<? extends Number> range, Limit limit) {
boundZSetOps.reverseRangeAndStoreByScore(dstKey, range, limit);
return new DefaultRedisZSet<>(getOperations().boundZSetOps(dstKey));
}
@@ -291,7 +291,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
}
@Override
public Set<E> removeByLex(Range<String> range) {
public RedisZSet<E> removeByLex(Range<String> range) {
boundZSetOps.removeRangeByLex(range);
return this;
}

View File

@@ -500,7 +500,7 @@ public interface RedisZSet<E> extends RedisCollection<E>, Set<E> {
* @since 3.0
* @see #rangeByScore(double, double)
*/
default RedisZSet<E> rangeAndStoreByScore(String dstKey, Range<Number> range) {
default RedisZSet<E> rangeAndStoreByScore(String dstKey, Range<? extends Number> range) {
return rangeAndStoreByScore(dstKey, range, Limit.unlimited());
}
@@ -516,7 +516,7 @@ public interface RedisZSet<E> extends RedisCollection<E>, Set<E> {
* @since 3.0
* @see #rangeByScore(double, double)
*/
RedisZSet<E> rangeAndStoreByScore(String dstKey, Range<Number> range, Limit limit);
RedisZSet<E> rangeAndStoreByScore(String dstKey, Range<? extends Number> range, Limit limit);
/**
* Store all elements at {@code dstKey} with reverse ordering by score from {@literal ZSET} at the bound key with a
@@ -528,7 +528,7 @@ public interface RedisZSet<E> extends RedisCollection<E>, Set<E> {
* @since 3.0
* @see #reverseRangeByScore(double, double)
*/
default RedisZSet<E> reverseRangeAndStoreByScore(String dstKey, Range<Number> range) {
default RedisZSet<E> reverseRangeAndStoreByScore(String dstKey, Range<? extends Number> range) {
return reverseRangeAndStoreByScore(dstKey, range, Limit.unlimited());
}
@@ -543,7 +543,7 @@ public interface RedisZSet<E> extends RedisCollection<E>, Set<E> {
* @return a new {@link RedisZSet} pointing at {@code destKey}
* @since 3.0
*/
RedisZSet<E> reverseRangeAndStoreByScore(String dstKey, Range<Number> range, Limit limit);
RedisZSet<E> reverseRangeAndStoreByScore(String dstKey, Range<? extends Number> range, Limit limit);
/**
* Remove elements in range between {@code start} and {@code end} from sorted set.
@@ -561,8 +561,7 @@ public interface RedisZSet<E> extends RedisCollection<E>, Set<E> {
* @return {@code this} set.
* @since 2.5
*/
// TODO: Switch to RedisZSet
Set<E> removeByLex(Range<String> range);
RedisZSet<E> removeByLex(Range<String> range);
/**
* Remove elements with scores between {@code min} and {@code max} from sorted set with the bound key.