@ParametersAreNullableByDefault public interface CloudEventBuilder extends CloudEventWriter<CloudEvent>
CloudEvent.| Modifier and Type | Method and Description |
|---|---|
CloudEvent |
build()
Build the event
|
static CloudEventBuilder |
fromSpecVersion(SpecVersion version)
Create a new builder for the specified
SpecVersion |
CloudEventBuilder |
newBuilder()
Copy this builder, creating a new instance with same values.
|
static CloudEventBuilder |
v03() |
static CloudEventBuilder |
v03(CloudEvent event) |
static CloudEventBuilder |
v1() |
static CloudEventBuilder |
v1(CloudEvent event) |
CloudEventBuilder |
withData(byte[] data)
Set the
data of the event |
CloudEventBuilder |
withData(String dataContentType,
byte[] data)
Set the
datacontenttype and data of the event |
CloudEventBuilder |
withData(String dataContentType,
URI dataSchema,
byte[] data)
Set the
datacontenttype, dataschema and data of the event |
CloudEventBuilder |
withDataContentType(String dataContentType)
Set the
datacontenttype of the event |
CloudEventBuilder |
withDataSchema(URI dataSchema)
Set the
dataschema of the event. |
CloudEventBuilder |
withExtension(Extension extension)
Add to the builder all the extension key/values of the provided extension
|
CloudEventBuilder |
withExtension(String key,
boolean value)
Set an extension with provided key and boolean value
|
CloudEventBuilder |
withExtension(String key,
Number value)
Set an extension with provided key and numeric value
|
CloudEventBuilder |
withExtension(String key,
String value)
Set an extension with provided key and string value
|
CloudEventBuilder |
withId(String id)
Set the
id of the event |
CloudEventBuilder |
withSource(URI source)
Set the
source of the event |
CloudEventBuilder |
withSubject(String subject)
Set the
subject of the event |
CloudEventBuilder |
withTime(ZonedDateTime time)
Set the
time of the event |
CloudEventBuilder |
withType(String type)
Set the
type of the event |
end, endsetAttribute, setAttribute, setAttributesetExtension, setExtension, setExtensionCloudEventBuilder withId(String id)
id of the eventid - id of the eventCloudEventBuilder withSource(URI source)
source of the eventsource - source of the eventCloudEventBuilder withType(String type)
type of the eventtype - type of the eventCloudEventBuilder withDataSchema(URI dataSchema)
dataschema of the event. For CloudEvent v0.3, this will configure the schemaurl attribute.dataSchema - dataschema of the eventCloudEventBuilder withDataContentType(String dataContentType)
datacontenttype of the eventdataContentType - datacontenttype of the eventCloudEventBuilder withSubject(String subject)
subject of the eventsubject - subject of the eventCloudEventBuilder withTime(ZonedDateTime time)
time of the eventtime - time of the eventCloudEventBuilder withData(byte[] data)
data of the eventdata - data of the eventCloudEventBuilder withData(String dataContentType, byte[] data)
datacontenttype and data of the eventdataContentType - datacontenttype of the eventdata - data of the eventCloudEventBuilder withData(String dataContentType, URI dataSchema, byte[] data)
datacontenttype, dataschema and data of the eventdataContentType - datacontenttype of the eventdataSchema - dataschema of the eventdata - data of the eventCloudEventBuilder withExtension(@Nonnull String key, String value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, Number value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, boolean value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull Extension extension)
extension - materialized extension to set in the eventCloudEvent build() throws IllegalStateException
IllegalStateException - if a required attribute is not configuredCloudEventBuilder newBuilder()
static CloudEventBuilder v1()
static CloudEventBuilder v1(@Nonnull CloudEvent event)
event - event to bootstrap the buildereventstatic CloudEventBuilder v03()
static CloudEventBuilder v03(@Nonnull CloudEvent event)
event - event to bootstrap the buildereventstatic CloudEventBuilder fromSpecVersion(@Nonnull SpecVersion version)
SpecVersionversion - version to use for the new builderCopyright © 2020. All rights reserved.