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) |
public void setConversionService(ConversionService conversionService)
public void setTypeConverter(TypeConverter typeConverter)
public T deserialize(byte[] bytes)
RedisSerializer
deserialize
in interface RedisSerializer<T>
bytes
- object binary representationpublic byte[] serialize(T object)
RedisSerializer
serialize
in interface RedisSerializer<T>
object
- object to serializepublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
Copyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.