org.springframework.data.redis.serializer
Class OxmSerializer

java.lang.Object
  extended by org.springframework.data.redis.serializer.OxmSerializer
All Implemented Interfaces:
InitializingBean, RedisSerializer<Object>

public class OxmSerializer
extends Object
implements InitializingBean, RedisSerializer<Object>

Serializer adapter on top of Spring's O/X Mapping. Delegates serialization/deserialization to OXM Marshaller and Unmarshaller. Note:Null objects are serialized as empty arrays and vice versa.


Constructor Summary
OxmSerializer()
           
OxmSerializer(Marshaller marshaller, Unmarshaller unmarshaller)
           
 
Method Summary
 void afterPropertiesSet()
           
 Object deserialize(byte[] bytes)
          Deserialize an object from the given binary data.
 byte[] serialize(Object t)
          Serialize the given object to binary data.
 void setMarshaller(Marshaller marshaller)
           
 void setUnmarshaller(Unmarshaller unmarshaller)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OxmSerializer

public OxmSerializer()

OxmSerializer

public OxmSerializer(Marshaller marshaller,
                     Unmarshaller unmarshaller)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

setMarshaller

public void setMarshaller(Marshaller marshaller)
Parameters:
marshaller - The marshaller to set.

setUnmarshaller

public void setUnmarshaller(Unmarshaller unmarshaller)
Parameters:
unmarshaller - The unmarshaller to set.

deserialize

public Object deserialize(byte[] bytes)
                   throws SerializationException
Description copied from interface: RedisSerializer
Deserialize an object from the given binary data.

Specified by:
deserialize in interface RedisSerializer<Object>
Parameters:
bytes - object binary representation
Returns:
the equivalent object instance
Throws:
SerializationException

serialize

public byte[] serialize(Object t)
                 throws SerializationException
Description copied from interface: RedisSerializer
Serialize the given object to binary data.

Specified by:
serialize in interface RedisSerializer<Object>
Parameters:
t - object to serialize
Returns:
the equivalent binary data
Throws:
SerializationException