Class JacksonEventDataMarshaller
java.lang.Object
com.opencqrs.framework.serialization.JacksonEventDataMarshaller
- All Implemented Interfaces:
EventDataMarshaller
EventDataMarshaller
implementation that uses a configurable ObjectMapper
for marshalling.-
Constructor Summary
ConstructorsConstructorDescriptionJacksonEventDataMarshaller
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescription<E> EventData
<E> deserialize
(Map<String, ?> json, Class<E> clazz)
-
Constructor Details
-
JacksonEventDataMarshaller
public JacksonEventDataMarshaller(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
serialize
Description copied from interface:EventDataMarshaller
- Specified by:
serialize
in interfaceEventDataMarshaller
- Type Parameters:
E
- the generic payload type- Parameters:
data
- the event data- Returns:
- a JSON-like map representation
-
deserialize
Description copied from interface:EventDataMarshaller
Converts a JSON-likeMap
representation toEventData
using the givenClass
to determine the payload type.- Specified by:
deserialize
in interfaceEventDataMarshaller
- Type Parameters:
E
- the generic payload type- Parameters:
json
- the JSON-like map representationclazz
- the target type of theEventData.payload()
- Returns:
- the event and meta-data
-