diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java
index fc0703061..335159d50 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.redis.connection;
-import org.springframework.data.redis.connection.stream.StreamRecords;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -31,13 +30,14 @@ import org.springframework.data.domain.Range;
import org.springframework.data.redis.connection.ReactiveRedisConnection.CommandResponse;
import org.springframework.data.redis.connection.ReactiveRedisConnection.KeyCommand;
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
+import org.springframework.data.redis.connection.RedisZSetCommands.Limit;
import org.springframework.data.redis.connection.stream.ByteBufferRecord;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.connection.stream.StreamReadOptions;
-import org.springframework.data.redis.connection.RedisZSetCommands.Limit;
+import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -139,7 +139,7 @@ public interface ReactiveStreamCommands {
* @param key the stream key.
* @param group name of the consumer group.
* @param recordIds record Id's to acknowledge.
- * @return
+ * @return {@link Mono} emitting the nr of acknowledged messages.
* @see Redis Documentation: XADD
*/
default Mono xAck(ByteBuffer key, String group, String... recordIds) {
@@ -157,7 +157,7 @@ public interface ReactiveStreamCommands {
* @param key the stream key.
* @param group name of the consumer group.
* @param recordIds record Id's to acknowledge.
- * @return
+ * @return {@link Mono} emitting the nr of acknowledged messages.
* @see Redis Documentation: XADD
*/
default Mono xAck(ByteBuffer key, String group, RecordId... recordIds) {
@@ -173,7 +173,7 @@ public interface ReactiveStreamCommands {
* Acknowledge one or more records as processed.
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Flux} emitting the nr of acknowledged messages per {@link AcknowledgeCommand}.
* @see Redis Documentation: XACK
*/
Flux> xAck(Publisher commands);
@@ -230,7 +230,7 @@ public interface ReactiveStreamCommands {
}
/**
- * @return
+ * @return the actual {@link ByteBufferRecord#getValue()}
*/
public Map getBody() {
return record.getValue();
@@ -246,7 +246,7 @@ public interface ReactiveStreamCommands {
*
* @param key must not be {@literal null}.
* @param body must not be {@literal null}.
- * @return
+ * @return {@link Mono} emitting the server generated {@link RecordId id}.
* @see Redis Documentation: XADD
*/
default Mono xAdd(ByteBuffer key, Map body) {
@@ -261,7 +261,7 @@ public interface ReactiveStreamCommands {
* Add stream record with given {@literal body} to {@literal key}.
*
* @param record must not be {@literal null}.
- * @return
+ * @return {@link Mono} the {@link RecordId id}.
* @see Redis Documentation: XADD
*/
default Mono xAdd(ByteBufferRecord record) {
@@ -275,7 +275,7 @@ public interface ReactiveStreamCommands {
* Add stream record with given {@literal body} to {@literal key}.
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Flux} emitting the {@link RecordId} on by for for the given {@link AddStreamRecord} commands.
* @see Redis Documentation: XADD
*/
Flux> xAdd(Publisher commands);
@@ -349,7 +349,7 @@ public interface ReactiveStreamCommands {
*
* @param key the stream key.
* @param recordIds stream record Id's.
- * @return number of removed entries.
+ * @return {@link Mono} emitting the number of removed entries.
* @see Redis Documentation: XDEL
*/
default Mono xDel(ByteBuffer key, String... recordIds) {
@@ -366,7 +366,7 @@ public interface ReactiveStreamCommands {
*
* @param key the stream key.
* @param recordIds stream record Id's.
- * @return number of removed entries.
+ * @return {@link Mono} emitting the number of removed entries.
* @see Redis Documentation: XDEL
*/
default Mono xDel(ByteBuffer key, RecordId... recordIds) {
@@ -382,7 +382,7 @@ public interface ReactiveStreamCommands {
* number of IDs passed in case certain IDs do not exist.
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Mono} emitting the number of removed entries.
* @see Redis Documentation: XDEL
*/
Flux> xDel(Publisher commands);
@@ -391,7 +391,7 @@ public interface ReactiveStreamCommands {
* Get the size of the stream stored at {@literal key}.
*
* @param key must not be {@literal null}.
- * @return length of the stream.
+ * @return {@link Mono} emitting the length of the stream.
* @see Redis Documentation: XLEN
*/
default Mono xLen(ByteBuffer key) {
@@ -405,7 +405,7 @@ public interface ReactiveStreamCommands {
* Get the size of the stream stored at {@link KeyCommand#getKey()}
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Flux} emitting the length of the stream per {@link KeyCommand}.
* @see Redis Documentation: XLEN
*/
Flux> xLen(Publisher commands);
@@ -501,7 +501,7 @@ public interface ReactiveStreamCommands {
*
* @param key the stream key.
* @param range must not be {@literal null}.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting with members of the stream.
* @see Redis Documentation: XRANGE
*/
default Flux xRange(ByteBuffer key, Range range) {
@@ -514,7 +514,7 @@ public interface ReactiveStreamCommands {
* @param key the stream key.
* @param range must not be {@literal null}.
* @param limit must not be {@literal null}.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting with members of the stream.
* @see Redis Documentation: XRANGE
*/
default Flux xRange(ByteBuffer key, Range range, Limit limit) {
@@ -531,7 +531,7 @@ public interface ReactiveStreamCommands {
* Read records from a stream within a specific {@link Range} applying a {@link Limit}.
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Flux} emitting with members of the stream per {@link RangeCommand}.
* @see Redis Documentation: XRANGE
*/
Flux>> xRange(Publisher commands);
@@ -633,7 +633,7 @@ public interface ReactiveStreamCommands {
* Read records from one or more {@link StreamOffset}s.
*
* @param streams the streams to read from.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting with members of the stream.
* @see Redis Documentation: XREAD
*/
default Flux xRead(StreamOffset... streams) {
@@ -645,7 +645,7 @@ public interface ReactiveStreamCommands {
*
* @param readOptions read arguments.
* @param streams the streams to read from.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting with members of the stream.
* @see Redis Documentation: XREAD
*/
default Flux xRead(StreamReadOptions readOptions, StreamOffset... streams) {
@@ -661,7 +661,7 @@ public interface ReactiveStreamCommands {
* Read records from one or more {@link StreamOffset}s.
*
* @param commands must not be {@literal null}.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting the members of the stream per {@link ReadCommand}.
* @see Redis Documentation: XREAD
* @see Redis Documentation: XREADGROUP
*/
@@ -675,7 +675,7 @@ public interface ReactiveStreamCommands {
private final @Nullable ReadOffset offset;
public GroupCommand(@Nullable ByteBuffer key, GroupCommandAction action, @Nullable String groupName,
- @Nullable String consumerName, ReadOffset offset) {
+ @Nullable String consumerName, @Nullable ReadOffset offset) {
super(key);
this.action = action;
@@ -732,7 +732,7 @@ public interface ReactiveStreamCommands {
}
public enum GroupCommandAction {
- CREATE, SET_ID, DESTROY, DELETE_CONSUMER;
+ CREATE, SET_ID, DESTROY, DELETE_CONSUMER
}
}
@@ -800,7 +800,7 @@ public interface ReactiveStreamCommands {
* Execute the given {@link GroupCommand} to {@literal create, destroy,... } groups.
*
* @param commands
- * @return
+ * @return {@link Flux} emitting the results of the {@link GroupCommand} one by one.
*/
Flux> xGroup(Publisher commands);
@@ -809,7 +809,7 @@ public interface ReactiveStreamCommands {
*
* @param consumer consumer/group.
* @param streams the streams to read from.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting the members of the stream
* @see Redis Documentation: XREADGROUP
*/
default Flux xReadGroup(Consumer consumer, StreamOffset... streams) {
@@ -822,7 +822,7 @@ public interface ReactiveStreamCommands {
* @param consumer consumer/group.
* @param readOptions read arguments.
* @param streams the streams to read from.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting the members of the stream.
* @see Redis Documentation: XREADGROUP
*/
default Flux xReadGroup(Consumer consumer, StreamReadOptions readOptions,
@@ -841,7 +841,7 @@ public interface ReactiveStreamCommands {
*
* @param key the stream key.
* @param range must not be {@literal null}.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting the members of the stream in reverse.
* @see Redis Documentation: XREVRANGE
*/
default Flux xRevRange(ByteBuffer key, Range range) {
@@ -854,7 +854,7 @@ public interface ReactiveStreamCommands {
* @param key the stream key.
* @param range must not be {@literal null}.
* @param limit must not be {@literal null}.
- * @return list with members of the resulting stream.
+ * @return {@link Flux} emitting the members of the stream in reverse.
* @see Redis Documentation: XREVRANGE
*/
default Flux xRevRange(ByteBuffer key, Range range, Limit limit) {
@@ -871,7 +871,7 @@ public interface ReactiveStreamCommands {
* Read records from a stream within a specific {@link Range} applying a {@link Limit} in reverse order.
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Flux} emitting the members of the stream in reverse.
* @see Redis Documentation: XREVRANGE
*/
Flux>> xRevRange(Publisher commands);
@@ -929,7 +929,7 @@ public interface ReactiveStreamCommands {
*
* @param key the stream key.
* @param count length of the stream.
- * @return number of removed entries.
+ * @return {@link Mono} emitting the number of removed entries.
* @see Redis Documentation: XTRIM
*/
default Mono xTrim(ByteBuffer key, long count) {
@@ -943,7 +943,7 @@ public interface ReactiveStreamCommands {
* Trims the stream to {@code count} elements.
*
* @param commands must not be {@literal null}.
- * @return
+ * @return {@link Flux} emitting the number of removed entries per {@link TrimCommand}.
* @see Redis Documentation: XTRIM
*/
Flux> xTrim(Publisher commands);
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
index 1373a3650..aed0a3580 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
@@ -120,6 +120,7 @@ class LettuceReactiveStreamCommands implements ReactiveStreamCommands {
}
@Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Flux> xGroup(Publisher commands) {
return connection.execute(cmd -> Flux.from(commands).concatMap(command -> {
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
index f0b2d6455..ea233fb9e 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
@@ -94,7 +94,7 @@ public class StreamRecords {
/**
* Obtain new instance of {@link RecordBuilder} to fluently create {@link Record records}.
*
- * @return
+ * @return new instance of {@link RecordBuilder}.
*/
public static RecordBuilder> newRecord() {
return new RecordBuilder<>(null, RecordId.autoGenerate());
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
index e9468ea5d..1fdab753c 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
@@ -123,6 +123,7 @@ class DefaultStreamOperations extends AbstractOperations i
*/
@Nullable
@Override
+ @SuppressWarnings("unchecked")
public RecordId add(Record record) {
Assert.notNull(record, "Record must not be null");
@@ -278,11 +279,7 @@ class DefaultStreamOperations extends AbstractOperations i
return hashValueSerializer() != null;
}
- protected HV deserializeHashValue(byte[] bytes, Class targetType) {
- return hashValueSerializerPresent() ? (HV) hashValueSerializer().deserialize(bytes)
- : objectMapper.getConversionService().convert(bytes, targetType);
- }
-
+ @SuppressWarnings({"rawtypes", "unchecked"})
private byte[] serialize(Object value, RedisSerializer serializer) {
Object _value = value;
@@ -302,9 +299,13 @@ class DefaultStreamOperations extends AbstractOperations i
abstract class RecordDeserializingRedisCallback implements RedisCallback>> {
+ @SuppressWarnings("unchecked")
public final List> doInRedis(RedisConnection connection) {
List raw = inRedis(connection);
+ if(raw == null) {
+ return Collections.emptyList();
+ }
List> result = new ArrayList<>();
for (ByteRecord record : raw) {
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
index d33273f46..456e27437 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
@@ -164,7 +164,7 @@ public interface ReactiveStreamOperations extends HashMapperProvider<
/**
* Create a consumer group at the {@link ReadOffset#latest() latest offset}.
*
- * @param key
+ * @param key the {@literal key} the stream is stored at.
* @param group name of the consumer group.
* @return the {@link Mono} emitting {@literal OK} if successful.. {@literal null} when used in pipeline /
* transaction.
@@ -176,8 +176,8 @@ public interface ReactiveStreamOperations extends HashMapperProvider<
/**
* Create a consumer group.
*
- * @param key
- * @param readOffset
+ * @param key the {@literal key} the stream is stored at.
+ * @param readOffset the {@link ReadOffset} to apply.
* @param group name of the consumer group.
* @return the {@link Mono} emitting {@literal OK} if successful.
*/
@@ -270,6 +270,7 @@ public interface ReactiveStreamOperations extends HashMapperProvider<
* @return the {@link Flux} emitting records one by one.
* @see Redis Documentation: XREAD
*/
+ @SuppressWarnings("unchecked")
default Flux> read(StreamOffset stream) {
Assert.notNull(stream, "StreamOffset must not be null");
@@ -285,6 +286,7 @@ public interface ReactiveStreamOperations extends HashMapperProvider<
* @return the {@link Flux} emitting records one by one.
* @see Redis Documentation: XREAD
*/
+ @SuppressWarnings("unchecked")
default Flux> read(Class targetType, StreamOffset stream) {
Assert.notNull(stream, "StreamOffset must not be null");
diff --git a/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java b/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java
index aec5b2130..574b1aedb 100644
--- a/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java
+++ b/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java
@@ -137,7 +137,7 @@ class StreamObjectMapper {
* single-element and multi-element list transformation.l
*
* @param records the {@link MapRecord} that should be mapped.
- * @param hashMapperProvider
+ * @param hashMapperProvider the provider to obtain the actual {@link HashMapper} from. Must not be {@literal null}.
* @param targetType the requested {@link Class target type}.
* @return the resulting {@link List} of {@link ObjectRecord} or {@literal null} if {@code records} was
* {@literal null}.
@@ -178,14 +178,17 @@ class StreamObjectMapper {
*
* @param conversionService the used {@link ConversionService}.
* @param targetType the target type.
- * @return
+ * @return obtain the {@link HashMapper} for a certain type.
*/
protected HashMapper, ?, ?> doGetHashMapper(ConversionService conversionService, Class> targetType) {
return this.objectHashMapper != null ? objectHashMapper : this.mapper;
}
/**
- * @param targetType
+ * Check if the given type is a simple type as in
+ * {@link org.springframework.data.convert.CustomConversions#isSimpleType(Class)}.
+ *
+ * @param targetType the type to inspect. Must not be {@literal null}.
* @return {@literal true} if {@link Class targetType} is a simple type.
* @see org.springframework.data.convert.CustomConversions#isSimpleType(Class)
*/
diff --git a/src/main/java/org/springframework/data/redis/core/StreamOperations.java b/src/main/java/org/springframework/data/redis/core/StreamOperations.java
index 1a81fdc20..16936112b 100644
--- a/src/main/java/org/springframework/data/redis/core/StreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/StreamOperations.java
@@ -162,7 +162,7 @@ public interface StreamOperations extends HashMapperProvider
/**
* Create a consumer group at the {@link ReadOffset#latest() latest offset}.
*
- * @param key
+ * @param key the {@literal key} the stream is stored at.
* @param group name of the consumer group.
* @return {@literal OK} if successful. {@literal null} when used in pipeline / transaction.
*/
@@ -173,8 +173,8 @@ public interface StreamOperations extends HashMapperProvider
/**
* Create a consumer group.
*
- * @param key
- * @param readOffset
+ * @param key the {@literal key} the stream is stored at.
+ * @param readOffset the {@link ReadOffset} to apply.
* @param group name of the consumer group.
* @return {@literal OK} if successful. {@literal null} when used in pipeline / transaction.
*/
diff --git a/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java b/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java
index 80be613b2..90d985284 100644
--- a/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java
+++ b/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java
@@ -152,33 +152,6 @@ public class ObjectHashMapper implements HashMapper