Class MapJsonSerializer
java.lang.Object
org.springframework.integration.ip.tcp.serializer.MapJsonSerializer
- All Implemented Interfaces:
- Deserializer<Map<?,,- ?>> - Serializer<Map<?,- ?>> 
public class MapJsonSerializer
extends Object
implements Serializer<Map<?,?>>, Deserializer<Map<?,?>>  
Serializes a 
Map as JSON. Deserializes JSON to
 a Map. The default JsonObjectMapperProvider.newInstance() can be
 overridden using setJsonObjectMapper(JsonObjectMapper).
 
 The JSON deserializer can't delimit multiple JSON
 objects. Therefore, another (de)serializer is used to
 apply structure to the stream. By default, this is a
 simple ByteArrayLfSerializer, which inserts/expects
 LF (0x0a) between messages.
- Since:
- 3.0
- Author:
- Gary Russell, Artem Bilan
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionMap<?, ?> deserialize(InputStream inputStream) voidserialize(Map<?, ?> object, OutputStream outputStream) voidsetJsonObjectMapper(JsonObjectMapper<?, ?> jsonObjectMapper) AnJsonObjectMapperto be used for the conversion to/from JSON.voidsetPacketDeserializer(Deserializer<byte[]> packetDeserializer) ADeserializerthat will construct the full JSON content from the stream which is then passed to the JsonObjectMapper.voidsetPacketSerializer(Serializer<byte[]> packetSerializer) ASerializerthat will delimit the full JSON content in the stream.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.serializer.DeserializerdeserializeFromByteArrayMethods inherited from interface org.springframework.core.serializer.SerializerserializeToByteArray
- 
Constructor Details- 
MapJsonSerializerpublic MapJsonSerializer()
 
- 
- 
Method Details- 
setJsonObjectMapperAnJsonObjectMapperto be used for the conversion to/from JSON. Use this if you wish to set additionalJsonObjectMapperimplementation features.- Parameters:
- jsonObjectMapper- the jsonObjectMapper.
 
- 
setPacketDeserializerADeserializerthat will construct the full JSON content from the stream which is then passed to the JsonObjectMapper. Default isByteArrayLfSerializer.- Parameters:
- packetDeserializer- the packetDeserializer
 
- 
setPacketSerializerASerializerthat will delimit the full JSON content in the stream. Default isByteArrayLfSerializer.- Parameters:
- packetSerializer- the packetSerializer
 
- 
deserialize- Specified by:
- deserializein interface- Deserializer<Map<?,- ?>> 
- Throws:
- IOException
 
- 
serialize- Specified by:
- serializein interface- Serializer<Map<?,- ?>> 
- Throws:
- IOException
 
 
-