public abstract class BaseCloudEventBuilder<SELF extends BaseCloudEventBuilder<SELF,T>,T extends CloudEvent> extends Object implements CloudEventBuilder
| Modifier and Type | Field and Description |
|---|---|
protected CloudEventData |
data |
protected Map<String,Object> |
extensions |
| Constructor and Description |
|---|
BaseCloudEventBuilder() |
BaseCloudEventBuilder(CloudEvent event) |
BaseCloudEventBuilder(CloudEventContext context) |
| Modifier and Type | Method and Description |
|---|---|
protected static IllegalStateException |
createMissingAttributeException(String attributeName) |
CloudEvent |
end() |
CloudEvent |
end(CloudEventData value) |
protected void |
requireValidAttributeWrite(String name) |
protected abstract void |
setAttributes(CloudEventContext event) |
SELF |
withData(byte[] data)
Set the
data of the event |
SELF |
withData(CloudEventData data)
Set the
data of the event |
SELF |
withData(String dataContentType,
byte[] data)
Set the
datacontenttype and data of the event |
SELF |
withData(String dataContentType,
CloudEventData data)
Set the
datacontenttype and data of the event |
SELF |
withData(String dataContentType,
URI dataSchema,
byte[] data)
Set the
datacontenttype, dataschema and data of the event |
SELF |
withData(String dataContentType,
URI dataSchema,
CloudEventData data)
Set the
datacontenttype, dataschema and data of the event |
SELF |
withExtension(CloudEventExtension extension)
Add to the builder all the extension key/values of the provided extension
|
SELF |
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
|
SELF |
withExtension(String key,
Number value)
Set an extension with provided key and numeric value
|
SELF |
withExtension(String key,
OffsetDateTime value)
Set an extension with provided key and boolean value
|
SELF |
withExtension(String key,
String value)
Set an extension with provided key and string value
|
SELF |
withExtension(String key,
URI value)
Set an extension with provided key and uri value
|
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 |
SELF |
withoutExtension(CloudEventExtension extension)
Remove from the the builder the provided extension, if any
|
SELF |
withoutExtension(String key)
Remove from the the builder the provided extension key, if any
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuild, from, fromContext, fromSpecVersion, newBuilder, v03, v03, v1, v1, withDataContentType, withDataSchema, withId, withSource, withSubject, withTime, withTypewithContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttributeprotected CloudEventData data
public BaseCloudEventBuilder()
public BaseCloudEventBuilder(CloudEventContext context)
public BaseCloudEventBuilder(CloudEvent event)
protected abstract void setAttributes(CloudEventContext event)
public SELF withData(byte[] data)
CloudEventBuilderdata of the eventwithData in interface CloudEventBuilderdata - data of the eventpublic SELF withData(String dataContentType, byte[] data)
CloudEventBuilderdatacontenttype and data of the eventwithData in interface CloudEventBuilderdataContentType - datacontenttype of the eventdata - data of the eventpublic SELF withData(String dataContentType, URI dataSchema, byte[] data)
CloudEventBuilderdatacontenttype, dataschema and data of the eventwithData in interface CloudEventBuilderdataContentType - datacontenttype of the eventdataSchema - dataschema of the eventdata - data of the eventpublic SELF withData(CloudEventData data)
CloudEventBuilderdata of the eventwithData in interface CloudEventBuilderdata - data of the eventpublic SELF withData(String dataContentType, CloudEventData data)
CloudEventBuilderdatacontenttype and data of the eventwithData in interface CloudEventBuilderdataContentType - datacontenttype of the eventdata - data of the eventpublic SELF withData(String dataContentType, URI dataSchema, CloudEventData data)
CloudEventBuilderdatacontenttype, dataschema and data of the eventwithData in interface CloudEventBuilderdataContentType - datacontenttype of the eventdataSchema - dataschema of the eventdata - data of the eventpublic CloudEventBuilder withoutData()
CloudEventBuilderdatacontenttype, dataschema and data from the eventwithoutData in interface CloudEventBuilderpublic CloudEventBuilder withoutDataSchema()
CloudEventBuilderdataschema from the eventwithoutDataSchema in interface CloudEventBuilderpublic CloudEventBuilder withoutDataContentType()
CloudEventBuilderdatacontenttype from the eventwithoutDataContentType in interface CloudEventBuilderpublic SELF withExtension(@Nonnull String key, @Nonnull String value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull String key, @Nonnull Number value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull String key, @Nonnull Boolean value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull String key, @Nonnull URI value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull String key, @Nonnull OffsetDateTime value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic CloudEventBuilder withExtension(@Nonnull String key, @Nonnull byte[] value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withoutExtension(@Nonnull String key)
CloudEventBuilderwithoutExtension in interface CloudEventBuilderkey - key of the extension attributepublic SELF withoutExtension(@Nonnull CloudEventExtension extension)
CloudEventBuilderwithoutExtension in interface CloudEventBuilderextension - materialized extension to remove from the builderpublic SELF withExtension(@Nonnull CloudEventExtension extension)
CloudEventBuilderwithExtension in interface CloudEventBuilderextension - materialized extension to set in the builderpublic CloudEvent end(CloudEventData value) throws CloudEventRWException
end in interface CloudEventWriter<CloudEvent>CloudEventRWExceptionpublic CloudEvent end()
end in interface CloudEventWriter<CloudEvent>protected static IllegalStateException createMissingAttributeException(String attributeName)
protected void requireValidAttributeWrite(String name)
Copyright © 2023. All rights reserved.