Interface EventDataMarshaller
- All Known Implementing Classes:
JacksonEventDataMarshaller
public interface EventDataMarshaller
Interface implemented for transforming Java event objects and additional meta-data to JSON-like maps, and vice versa.
Used for transformations to or from
Event.data()
and to EventCandidate.data()
.
To ensure interoperability, implementations of this
should conform to the same JSON schema for the
data
event content, i.e. using metadata
for EventData.metaData()
and payload
for
EventData.payload()
, e.g. as follows:
{ "data": { "metadata": { "userId": "345897345" }, "payload": { // serialized java object } }, // other cloud event attributes omitted for brevity }
-
Method Summary
Modifier and TypeMethodDescription<E> EventData
<E> deserialize
(Map<String, ?> json, Class<E> clazz)
-
Method Details
-
serialize
- Type Parameters:
E
- the generic payload type- Parameters:
data
- the event data- Returns:
- a JSON-like map representation
-
deserialize
Converts a JSON-likeMap
representation toEventData
using the givenClass
to determine the payload type.- 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
-