public interface RedisSerializer<T>
Modifier and Type | Method and Description |
---|---|
static RedisSerializer<byte[]> |
byteArray()
Obtain a
RedisSerializer that passes thru byte[] . |
default boolean |
canSerialize(Class<?> type) |
T |
deserialize(byte[] bytes)
Deserialize an object from the given binary data.
|
default Class<?> |
getTargetType() |
static RedisSerializer<Object> |
java()
Obtain a
RedisSerializer using java serialization. |
static RedisSerializer<Object> |
java(ClassLoader classLoader)
Obtain a
RedisSerializer using java serialization with the given ClassLoader . |
static RedisSerializer<Object> |
json()
Obtain a
RedisSerializer that can read and write JSON using
Jackson. |
byte[] |
serialize(T t)
Serialize the given object to binary data.
|
static RedisSerializer<String> |
string()
|
@Nullable byte[] serialize(@Nullable T t) throws SerializationException
t
- object to serialize. Can be null.SerializationException
@Nullable T deserialize(@Nullable byte[] bytes) throws SerializationException
bytes
- object binary representation. Can be null.SerializationException
static RedisSerializer<Object> java()
RedisSerializer
using java serialization.serializable
.static RedisSerializer<Object> java(@Nullable ClassLoader classLoader)
RedisSerializer
using java serialization with the given ClassLoader
.serializable
.classLoader
- the ClassLoader
to use for deserialization. Can be null.RedisSerializer
. Never null.static RedisSerializer<Object> json()
RedisSerializer
that can read and write JSON using
Jackson.static RedisSerializer<String> string()
static RedisSerializer<byte[]> byteArray()
RedisSerializer
that passes thru byte[]
.default boolean canSerialize(Class<?> type)
default Class<?> getTargetType()
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.