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
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S,K, V> MapRecord <S, K, V> default <SK,HK, HV> MapRecord <SK, HK, HV> Apply the givenmapFunctionto each and every entry in the backing collection to create a newMapRecord.default ByteRecordserialize(@Nullable RedisSerializer<?> serializer) default ByteRecordserialize(@Nullable RedisSerializer<? super S> streamSerializer, @Nullable RedisSerializer<? super K> fieldSerializer, @Nullable RedisSerializer<? super V> valueSerializer) Serializekeywith 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 givenHashMapperto the backing value to create a newMapRecord.withStreamKey(SK key) Create a new instance ofRecordwith the given key to store the record at.Methods inherited from interface Iterable
forEach, iterator, spliteratorMethods inherited from interface Record
getId, getRequiredStream, getStream, getValue
-
Method Details
-
create
- Parameters:
stream- the stream key.map- the value.- Returns:
- the
ObjectRecordholding thestreamkey andvalue.
-
withId
-
withStreamKey
-
mapEntries
default <HK,HV> MapRecord<S,HK, mapEntriesHV> (Function<Map.Entry<K, V>, Map.Entry<HK, HV>> mapFunction) Apply the givenmapFunctionto 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
Serializekeyandfield/value pairswith the givenRedisSerializer. An already assignedidis carried over to the new instance.- Parameters:
serializer- can be null if theRecordonly holds binary data.- Returns:
- new
ByteRecordholding the serialized values.
-
serialize
default ByteRecord serialize(@Nullable RedisSerializer<? super S> streamSerializer, @Nullable RedisSerializer<? super K> fieldSerializer, @Nullable RedisSerializer<? super V> valueSerializer) Serializekeywith the streamSerializer, field names with the fieldSerializer and values with the valueSerializer. An already assignedidis 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
ByteRecordholding the serialized values.
-
toObjectRecord
Apply the givenHashMapperto the backing value to create a newMapRecord. An already assignedidis 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.
-