public class GenericToStringSerializer<T> extends Object implements RedisSerializer<T>, BeanFactoryAware
ConversionService
to transform objects
into String and vice versa. The Strings are convert into bytes and vice-versa using the specified charset (by default
UTF-8). Note: The conversion service initialization happens automatically if the class is defined as a Spring
bean. Note: Does not handle nulls in any special way delegating everything to the container.Constructor and Description |
---|
GenericToStringSerializer(Class<T> type) |
GenericToStringSerializer(Class<T> type,
Charset charset) |
Modifier and Type | Method and Description |
---|---|
T |
deserialize(byte[] bytes)
Deserialize an object from the given binary data.
|
byte[] |
serialize(T object)
Serialize the given object to binary data.
|
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setConversionService(ConversionService conversionService) |
void |
setTypeConverter(TypeConverter typeConverter) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
byteArray, canSerialize, getTargetType, java, java, json, string
public void setConversionService(ConversionService conversionService)
public void setTypeConverter(TypeConverter typeConverter)
public T deserialize(@Nullable byte[] bytes)
RedisSerializer
deserialize
in interface RedisSerializer<T>
bytes
- object binary representation. Can be null.public byte[] serialize(@Nullable T object)
RedisSerializer
serialize
in interface RedisSerializer<T>
object
- object to serialize. Can be null.public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.