public class OxmSerializer extends Object implements InitializingBean, RedisSerializer<Object>
Marshaller
and Unmarshaller
. Note: null objects are serialized as empty arrays and vice versa.Constructor and Description |
---|
OxmSerializer()
Creates a new, uninitialized
OxmSerializer . |
OxmSerializer(Marshaller marshaller,
Unmarshaller unmarshaller)
|
Modifier and Type | Method and Description |
---|---|
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
byteArray, canSerialize, getTargetType, java, java, json, string
public OxmSerializer()
OxmSerializer
. Requires setMarshaller(Marshaller)
and
setUnmarshaller(Unmarshaller)
to be set before this serializer can be used.public OxmSerializer(Marshaller marshaller, Unmarshaller unmarshaller)
marshaller
- must not be null.unmarshaller
- must not be null.public void setMarshaller(Marshaller marshaller)
marshaller
- The marshaller to set.public void setUnmarshaller(Unmarshaller unmarshaller)
unmarshaller
- The unmarshaller to set.public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public Object deserialize(@Nullable byte[] bytes) throws SerializationException
RedisSerializer
deserialize
in interface RedisSerializer<Object>
bytes
- object binary representation. Can be null.SerializationException
public byte[] serialize(@Nullable Object t) throws SerializationException
RedisSerializer
serialize
in interface RedisSerializer<Object>
t
- object to serialize. Can be null.SerializationException
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.