Interface MapRecord<S,K,V>
- Type Parameters:
K
- the field type of the backing map.V
- the value type of the backing map.
- All Known Subinterfaces:
ByteBufferRecord
,ByteRecord
,StringRecord
A
Record
within the stream backed by a collection of field/value pairs.- Since:
- 2.2
- Author:
- Christoph Strobl, Mark Paluch, Romain Beghi
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S,
K, V> MapRecord<S, K, V> default <SK,
HK, HV> MapRecord<SK, HK, HV> Apply the givenmapFunction
to each and every entry in the backing collection to create a newMapRecord
.default ByteRecord
serialize
(RedisSerializer<?> serializer) default ByteRecord
serialize
(RedisSerializer<? super S> streamSerializer, RedisSerializer<? super K> fieldSerializer, RedisSerializer<? super V> valueSerializer) Serializekey
with the streamSerializer, field names with the fieldSerializer and values with the valueSerializer.default <OV> ObjectRecord<S,
OV> toObjectRecord
(HashMapper<? super OV, ? super K, ? super V> mapper) Apply the givenHashMapper
to the backing value to create a newMapRecord
.withStreamKey
(SK key) Create a new instance ofRecord
with the given key to store the record at.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.springframework.data.redis.connection.stream.Record
getId, getRequiredStream, getStream, getValue
-
Method Details
-
create
- Parameters:
stream
- the stream key.map
- the value.- Returns:
- the
ObjectRecord
holding thestream
key andvalue
.
-
withId
Description copied from interface:Record
-
withStreamKey
Description copied from interface:Record
Create a new instance ofRecord
with the given key to store the record at.- Specified by:
withStreamKey
in interfaceRecord<S,
K> - Parameters:
key
- the Redis key identifying the stream.- Returns:
- new instance of
Record
.
-
mapEntries
default <HK,HV> MapRecord<S,HK, mapEntriesHV> (Function<Map.Entry<K, V>, Map.Entry<HK, HV>> mapFunction) Apply the givenmapFunction
to each and every entry in the backing collection to create a newMapRecord
.- Type Parameters:
HK
- the field type of the new backing collection.HV
- the value type of the new backing collection.- Parameters:
mapFunction
- must not be null.- Returns:
- new instance of
MapRecord
.
-
map
-
serialize
Serializekey
andfield/value pairs
with the givenRedisSerializer
. An already assignedid
is carried over to the new instance.- Parameters:
serializer
- can be null if theRecord
only holds binary data.- Returns:
- new
ByteRecord
holding the serialized values.
-
serialize
default ByteRecord serialize(@Nullable RedisSerializer<? super S> streamSerializer, @Nullable RedisSerializer<? super K> fieldSerializer, @Nullable RedisSerializer<? super V> valueSerializer) Serializekey
with the streamSerializer, field names with the fieldSerializer and values with the valueSerializer. An already assignedid
is carried over to the new instance.- Parameters:
streamSerializer
- can be null if the key is binary.fieldSerializer
- can be null if the fields are binary.valueSerializer
- can be null if the values are binary.- Returns:
- new
ByteRecord
holding the serialized values.
-
toObjectRecord
Apply the givenHashMapper
to the backing value to create a newMapRecord
. An already assignedid
is carried over to the new instance.- Type Parameters:
OV
- type of the value backing theObjectRecord
.- Parameters:
mapper
- must not be null.- Returns:
- new instance of
ObjectRecord
.
-