public final class CloudEventUtils extends Object
io.cloudevents related interfaces| Modifier and Type | Method and Description |
|---|---|
static <R extends CloudEventData> |
mapData(CloudEvent event,
CloudEventDataMapper<R> mapper)
Get the data contained in
event and map it using the provided mapper. |
static CloudEventContextReader |
toContextReader(CloudEventContext event)
Convert a
CloudEvent to a CloudEventContextReader. |
static CloudEvent |
toEvent(CloudEventReader reader)
Convert a
CloudEventReader to a CloudEvent. |
static CloudEvent |
toEvent(CloudEventReader reader,
CloudEventDataMapper<?> mapper)
|
static CloudEventReader |
toReader(CloudEvent event)
Convert a
CloudEvent to a CloudEventReader. |
public static CloudEventReader toReader(CloudEvent event)
CloudEvent to a CloudEventReader. This method provides a default implementation
for CloudEvent that doesn't implement CloudEventReader.
It's safe to use the returned CloudEventReader multiple times.
event - the event to convertpublic static CloudEventContextReader toContextReader(CloudEventContext event)
CloudEvent to a CloudEventContextReader. This method provides a default implementation
for CloudEvent that doesn't implement CloudEventContextReader.
It's safe to use the returned CloudEventReader multiple times.
event - the event to convertpublic static CloudEvent toEvent(CloudEventReader reader) throws CloudEventRWException
CloudEventReader to a CloudEvent.reader - the reader where to read the message fromCloudEventRWExceptionpublic static CloudEvent toEvent(CloudEventReader reader, CloudEventDataMapper<?> mapper) throws CloudEventRWException
reader - the reader where to read the message frommapper - the mapper to use when reading the dataCloudEventRWException@Nullable public static <R extends CloudEventData> R mapData(CloudEvent event, CloudEventDataMapper<R> mapper)
event and map it using the provided mapper.R - the returned CloudEventData implementation from the provided mapperevent - the event eventually containing the datamapper - the mapper to use to map the dataevent and mapped with mapper, if any, otherwise nullCopyright © 2024. All rights reserved.