public final class JsonFormat extends Object implements EventFormat
EventFormat for JSON event format
using Jackson. This format is resolvable with EventFormatProvider using the content type CONTENT_TYPE.| Modifier and Type | Field and Description |
|---|---|
static String |
CONTENT_TYPE |
| Constructor and Description |
|---|
JsonFormat() |
JsonFormat(boolean forceDataBase64Serialization,
boolean forceStringSerialization) |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
dataIsJsonContentType(String contentType) |
io.cloudevents.CloudEvent |
deserialize(byte[] bytes) |
static com.fasterxml.jackson.databind.module.SimpleModule |
getCloudEventJacksonModule() |
static com.fasterxml.jackson.databind.module.SimpleModule |
getCloudEventJacksonModule(boolean forceDataBase64Serialization,
boolean forceStringSerialization) |
byte[] |
serialize(io.cloudevents.CloudEvent event) |
String |
serializedContentType() |
JsonFormat |
withForceJsonDataToBase64() |
JsonFormat |
withForceNonJsonDataToString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserializableContentTypespublic static final String CONTENT_TYPE
public JsonFormat(boolean forceDataBase64Serialization,
boolean forceStringSerialization)
public JsonFormat()
public JsonFormat withForceJsonDataToBase64()
public JsonFormat withForceNonJsonDataToString()
public byte[] serialize(io.cloudevents.CloudEvent event)
throws EventSerializationException
serialize in interface EventFormatEventSerializationExceptionpublic io.cloudevents.CloudEvent deserialize(byte[] bytes)
throws EventDeserializationException
deserialize in interface EventFormatEventDeserializationExceptionpublic String serializedContentType()
serializedContentType in interface EventFormatpublic static com.fasterxml.jackson.databind.module.SimpleModule getCloudEventJacksonModule()
public static com.fasterxml.jackson.databind.module.SimpleModule getCloudEventJacksonModule(boolean forceDataBase64Serialization,
boolean forceStringSerialization)
withForceJsonDataToBase64() and withForceNonJsonDataToString() for more details.protected static boolean dataIsJsonContentType(String contentType)
Copyright © 2020. All rights reserved.