Polishing.

Fix indention, variable names and add missing author tags.

Original Pull Request: #2097
This commit is contained in:
Christoph Strobl
2021-06-29 12:32:58 +02:00
parent 38d3576052
commit d019ada080
6 changed files with 70 additions and 38 deletions

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.data.redis.connection;
import java.nio.charset.StandardCharsets;
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
import org.springframework.util.ObjectUtils;
@@ -23,6 +25,8 @@ import org.springframework.util.ObjectUtils;
* Default implementation for {@link StringTuple} interface.
*
* @author Costin Leau
* @author Mark Paluch
* @author Christoph Strobl
*/
public class DefaultStringTuple extends DefaultTuple implements StringTuple {
@@ -35,6 +39,7 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
* @param score
*/
public DefaultStringTuple(byte[] value, String valueAsString, Double score) {
super(value, score);
this.valueAsString = valueAsString;
@@ -43,13 +48,12 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
/**
* Constructs a new <code>DefaultStringTuple</code> instance.
*
* @param valueAsString
* @param valueAsString must not be {@literal null}.
* @param score
* @since 2.6
*/
public DefaultStringTuple(String valueAsString, double score) {
super(valueAsString.getBytes(), score);
this.valueAsString = valueAsString;
this(valueAsString.getBytes(StandardCharsets.UTF_8), valueAsString, score);
}
/**
@@ -59,6 +63,7 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
* @param valueAsString
*/
public DefaultStringTuple(Tuple tuple, String valueAsString) {
super(tuple.getValue(), tuple.getScore());
this.valueAsString = valueAsString;
}

View File

@@ -916,38 +916,38 @@ public interface ZSetOperations<K, V> {
@Nullable
Set<V> rangeByLex(K key, Range range, Limit limit);
/**
* Get all elements with reverse lexicographical ordering from {@literal ZSET} at {@code key} with a value between
* {@link Range#getMin()} and {@link Range#getMax()}.
*
* @param key must not be {@literal null}.
* @param range must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @since 2.4
* @see <a href="https://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
*/
@Nullable
default Set<V> reverseRangeByLex(K key, Range range) {
return reverseRangeByLex(key, range, Limit.unlimited());
}
/**
* Get all elements {@literal n} elements, where {@literal n = } {@link Limit#getCount()}, starting at
* {@link Limit#getOffset()} with reverse lexicographical ordering from {@literal ZSET} at {@code key} with a value
* between {@link Range#getMin()} and {@link Range#getMax()}.
*
* @param key must not be {@literal null}
* @param range must not be {@literal null}.
* @param limit can be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @since 2.4
* @see <a href="https://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
*/
@Nullable
Set<V> reverseRangeByLex(K key, Range range, Limit limit);
/**
* @return never {@literal null}.
*/
RedisOperations<K, V> getOperations();
/**
* Get all elements with reverse lexicographical ordering from {@literal ZSET} at {@code key} with a value between
* {@link Range#getMin()} and {@link Range#getMax()}.
*
* @param key must not be {@literal null}.
* @param range must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @since 2.4
* @see <a href="https://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
*/
@Nullable
default Set<V> reverseRangeByLex(K key, Range range) {
return reverseRangeByLex(key, range, Limit.unlimited());
}
/**
* Get all elements {@literal n} elements, where {@literal n = } {@link Limit#getCount()}, starting at
* {@link Limit#getOffset()} with reverse lexicographical ordering from {@literal ZSET} at {@code key} with a value
* between {@link Range#getMin()} and {@link Range#getMax()}.
*
* @param key must not be {@literal null}
* @param range must not be {@literal null}.
* @param limit can be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @since 2.4
* @see <a href="https://redis.io/commands/zrevrangebylex">Redis Documentation: ZREVRANGEBYLEX</a>
*/
@Nullable
Set<V> reverseRangeByLex(K key, Range range, Limit limit);
/**
* @return never {@literal null}.
*/
RedisOperations<K, V> getOperations();
}

View File

@@ -210,7 +210,7 @@ public interface RedisZSet<E> extends RedisCollection<E>, Set<E> {
/**
* Union this set and other {@link RedisZSet}s.
*
* @param set must not be {@literal null}.
* @param sets must not be {@literal null}.
* @return a {@link Set} containing the combined values with their scores.
* @since 2.6
*/