Interface RedisSerializationContext<K,V>
public interface RedisSerializationContext<K,V>
Serialization context for reactive use.
This context provides RedisSerializationContext.SerializationPair
s for key, value, hash-key (field), hash-value and String
serialization and deserialization.
- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Builder forRedisSerializationContext
.static interface
Typed serialization tuple. -
Method Summary
Modifier and TypeMethodDescriptionstatic RedisSerializationContext<byte[],
byte[]> Creates a newRedisSerializationContext
using abyte[]
serialization.Creates a newRedisSerializationContext
using aByteBuffer
serialization.static <T> RedisSerializationContext<T,
T> fromSerializer
(RedisSerializer<T> serializer) Creates a newRedisSerializationContext
using the givenRedisSerializer
.static RedisSerializationContext<Object,
Object> java()
Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
.static RedisSerializationContext<Object,
Object> java
(ClassLoader classLoader) Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
with givenClassLoader
.static <T> RedisSerializationContext<T,
T> just
(RedisSerializationContext.SerializationPair<T> serializationPair) Creates a newRedisSerializationContext
using the givenRedisSerializationContext.SerializationPair
.static <K,
V> RedisSerializationContext.RedisSerializationContextBuilder<K, V> Creates a newRedisSerializationContext.RedisSerializationContextBuilder
.static <K,
V> RedisSerializationContext.RedisSerializationContextBuilder<K, V> newSerializationContext
(RedisSerializationContext.SerializationPair<?> serializationPair) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializationContext.SerializationPair
.static <K,
V> RedisSerializationContext.RedisSerializationContextBuilder<K, V> newSerializationContext
(RedisSerializer<?> defaultSerializer) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializer
.static RedisSerializationContext<byte[],
byte[]> raw()
Deprecated.since 2.2.static RedisSerializationContext<String,
String> string()
Creates a newRedisSerializationContext
using aStringRedisSerializer
.
-
Method Details
-
newSerializationContext
static <K,V> RedisSerializationContext.RedisSerializationContextBuilder<K,V> newSerializationContext()Creates a newRedisSerializationContext.RedisSerializationContextBuilder
.- Type Parameters:
K
- expected key type.V
- expected value type.- Returns:
- a new
RedisSerializationContext.RedisSerializationContextBuilder
.
-
newSerializationContext
static <K,V> RedisSerializationContext.RedisSerializationContextBuilder<K,V> newSerializationContext(RedisSerializer<?> defaultSerializer) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializer
.- Type Parameters:
K
- expected key type.V
- expected value type.- Parameters:
defaultSerializer
- must not be null.- Returns:
- a new
RedisSerializationContext.RedisSerializationContextBuilder
.
-
newSerializationContext
static <K,V> RedisSerializationContext.RedisSerializationContextBuilder<K,V> newSerializationContext(RedisSerializationContext.SerializationPair<?> serializationPair) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializationContext.SerializationPair
.- Type Parameters:
K
- expected key type.V
- expected value type.- Parameters:
serializationPair
- must not be null.- Returns:
- a new
RedisSerializationContext.RedisSerializationContextBuilder
.
-
raw
Deprecated.since 2.2. Please usebyteArray()
instead.Creates a newRedisSerializationContext
using abyte[]
serialization pair.- Returns:
- new instance of
RedisSerializationContext
.
-
byteArray
Creates a newRedisSerializationContext
using abyte[]
serialization.- Returns:
- new instance of
RedisSerializationContext
. - Since:
- 2.2
-
byteBuffer
Creates a newRedisSerializationContext
using aByteBuffer
serialization.- Returns:
- new instance of
RedisSerializationContext
. - Since:
- 2.2
-
java
Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
.- Returns:
- new instance of
RedisSerializationContext
. - Since:
- 2.1
-
java
Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
with givenClassLoader
.- Parameters:
classLoader
- theClassLoader
to use for deserialization. Can be null.- Returns:
- new instance of
RedisSerializationContext
. - Since:
- 2.1
-
string
Creates a newRedisSerializationContext
using aStringRedisSerializer
.- Returns:
-
fromSerializer
Creates a newRedisSerializationContext
using the givenRedisSerializer
.- Type Parameters:
T
-- Parameters:
serializer
- must not be null.- Returns:
-
just
static <T> RedisSerializationContext<T,T> just(RedisSerializationContext.SerializationPair<T> serializationPair) Creates a newRedisSerializationContext
using the givenRedisSerializationContext.SerializationPair
.- Type Parameters:
T
-- Parameters:
serializationPair
-- Returns:
-
getKeySerializationPair
RedisSerializationContext.SerializationPair<K> getKeySerializationPair()- Returns:
RedisSerializationContext.SerializationPair
for key-typed serialization and deserialization.
-
getValueSerializationPair
RedisSerializationContext.SerializationPair<V> getValueSerializationPair()- Returns:
RedisSerializationContext.SerializationPair
for value-typed serialization and deserialization.
-
getHashKeySerializationPair
- Returns:
RedisSerializationContext.SerializationPair
for hash-key-typed serialization and deserialization.
-
getHashValueSerializationPair
- Returns:
RedisSerializationContext.SerializationPair
for hash-value-typed serialization and deserialization.
-
getStringSerializationPair
RedisSerializationContext.SerializationPair<String> getStringSerializationPair()- Returns:
RedisSerializationContext.SerializationPair
forString
-typed serialization and deserialization.
-