@ParametersAreNullableByDefault public interface CloudEventBuilder extends CloudEventWriter<CloudEvent>
CloudEvent.| Modifier and Type | Method and Description |
|---|---|
CloudEvent |
build()
Build the event
|
static CloudEventBuilder |
from(CloudEvent event)
Create a new builder starting from the values of the provided event.
|
static CloudEventBuilder |
fromContext(CloudEventContext context)
Create a new builder starting from the values of the provided context.
|
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(CloudEventData 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,
CloudEventData 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 |
withData(String dataContentType,
URI dataSchema,
CloudEventData 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(CloudEventExtension 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,
byte[] value)
Set an extension with provided key and binary value
|
CloudEventBuilder |
withExtension(String key,
Number value)
Set an extension with provided key and numeric value
|
CloudEventBuilder |
withExtension(String key,
OffsetDateTime value)
Set an extension with provided key and boolean value
|
CloudEventBuilder |
withExtension(String key,
String value)
Set an extension with provided key and string value
|
CloudEventBuilder |
withExtension(String key,
URI value)
Set an extension with provided key and uri value
|
CloudEventBuilder |
withId(String id)
Set the
id of the event |
CloudEventBuilder |
withoutData()
Remove the
datacontenttype, dataschema and data from the event |
CloudEventBuilder |
withoutDataContentType()
Remove the
datacontenttype from the event |
CloudEventBuilder |
withoutDataSchema()
Remove the
dataschema from the event |
CloudEventBuilder |
withoutExtension(CloudEventExtension extension)
Remove from the the builder the provided extension, if any
|
CloudEventBuilder |
withoutExtension(String key)
Remove from the the builder the provided extension key, if any
|
CloudEventBuilder |
withSource(URI source)
Set the
source of the event |
CloudEventBuilder |
withSubject(String subject)
Set the
subject of the event |
CloudEventBuilder |
withTime(OffsetDateTime time)
Set the
time of the event |
CloudEventBuilder |
withType(String type)
Set the
type of the event |
end, endwithContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttributeCloudEventBuilder 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(OffsetDateTime 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 withData(CloudEventData data)
data of the eventdata - data of the eventCloudEventBuilder withData(String dataContentType, CloudEventData data)
datacontenttype and data of the eventdataContentType - datacontenttype of the eventdata - data of the eventCloudEventBuilder withData(String dataContentType, URI dataSchema, CloudEventData data)
datacontenttype, dataschema and data of the eventdataContentType - datacontenttype of the eventdataSchema - dataschema of the eventdata - data of the eventCloudEventBuilder withoutData()
datacontenttype, dataschema and data from the eventCloudEventBuilder withoutDataSchema()
dataschema from the eventCloudEventBuilder withoutDataContentType()
datacontenttype from the eventCloudEventBuilder withExtension(@Nonnull String key, @Nonnull String value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, @Nonnull Number value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, @Nonnull Boolean value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, @Nonnull URI value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, @Nonnull OffsetDateTime value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull String key, @Nonnull byte[] value)
key - key of the extension attributevalue - value of the extension attributeCloudEventBuilder withExtension(@Nonnull CloudEventExtension extension)
extension - materialized extension to set in the builderCloudEventBuilder withoutExtension(@Nonnull String key)
key - key of the extension attributeCloudEventBuilder withoutExtension(@Nonnull CloudEventExtension extension)
extension - materialized extension to remove from the builderCloudEvent 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 builderstatic CloudEventBuilder from(@Nonnull CloudEvent event)
event - event to copy values fromstatic CloudEventBuilder fromContext(@Nonnull CloudEventContext context)
context - context to copy values fromCopyright © 2024. All rights reserved.