Interface RedisSerializationContext.SerializationPair<T>
- Enclosing interface:
- RedisSerializationContext<K,
V>
public static interface RedisSerializationContext.SerializationPair<T>
Typed serialization tuple.
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionstatic RedisSerializationContext.SerializationPair<byte[]>
Creates a pass throughRedisSerializationContext.SerializationPair
to pass-thrubyte
objects.Creates a pass throughRedisSerializationContext.SerializationPair
to pass-thruByteBuffer
objects.static <T> RedisSerializationContext.SerializationPair<T>
fromSerializer
(RedisSerializer<T> serializer) Creates aRedisSerializationContext.SerializationPair
adapter givenRedisSerializer
.static <T> RedisSerializationContext.SerializationPair<T>
just
(RedisElementReader<? extends T> reader, RedisElementWriter<? extends T> writer) Creates aRedisSerializationContext.SerializationPair
adapter givenRedisElementReader
andRedisElementWriter
.static <T> RedisSerializationContext.SerializationPair<T>
raw()
Deprecated.since 2.2.default T
read
(ByteBuffer buffer) Deserialize aByteBuffer
into the according type.default ByteBuffer
Serialize the givenelement
to itsByteBuffer
representation.
-
Method Details
-
fromSerializer
static <T> RedisSerializationContext.SerializationPair<T> fromSerializer(RedisSerializer<T> serializer) Creates aRedisSerializationContext.SerializationPair
adapter givenRedisSerializer
.- Parameters:
serializer
- must not be null.- Returns:
- a
RedisSerializationContext.SerializationPair
adapter forRedisSerializer
.
-
just
static <T> RedisSerializationContext.SerializationPair<T> just(RedisElementReader<? extends T> reader, RedisElementWriter<? extends T> writer) Creates aRedisSerializationContext.SerializationPair
adapter givenRedisElementReader
andRedisElementWriter
.- Parameters:
reader
- must not be null.writer
- must not be null.- Returns:
- a
RedisSerializationContext.SerializationPair
encapsulatingRedisElementReader
andRedisElementWriter
.
-
raw
Deprecated.since 2.2. Please use eitherbyteArray()
orbyteBuffer()
.Creates a pass throughRedisSerializationContext.SerializationPair
to pass-thruByteBuffer
objects.- Returns:
- a pass through
RedisSerializationContext.SerializationPair
.
-
byteArray
Creates a pass throughRedisSerializationContext.SerializationPair
to pass-thrubyte
objects.- Returns:
- a pass through
RedisSerializationContext.SerializationPair
. - Since:
- 2.2
-
byteBuffer
Creates a pass throughRedisSerializationContext.SerializationPair
to pass-thruByteBuffer
objects.- Returns:
- a pass through
RedisSerializationContext.SerializationPair
. - Since:
- 2.2
-
getReader
RedisElementReader<T> getReader()- Returns:
- the
RedisElementReader
.
-
read
Deserialize aByteBuffer
into the according type.- Parameters:
buffer
- must not be null.- Returns:
- the deserialized value. Can be null.
-
getWriter
RedisElementWriter<T> getWriter()- Returns:
- the
RedisElementWriter
.
-
write
Serialize the givenelement
to itsByteBuffer
representation.- Parameters:
element
-Object
to write (serialize) as a stream of bytes.- Returns:
- the
ByteBuffer
representing the givenelement
in binary form.
-