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 aelement
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.
-
getWriter
RedisElementWriter<T> getWriter()- Returns:
- the
RedisElementWriter
.
-
write
Serialize aelement
to itsByteBuffer
representation.- Parameters:
element
-- Returns:
- the
ByteBuffer
representingelement
in its binary form.
-