public abstract class BaseCloudEventBuilder<SELF extends BaseCloudEventBuilder<SELF,T>,T extends CloudEvent> extends Object implements CloudEventBuilder
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
data |
protected Map<String,Object> |
extensions |
| Constructor and Description |
|---|
BaseCloudEventBuilder() |
BaseCloudEventBuilder(CloudEvent event) |
| Modifier and Type | Method and Description |
|---|---|
protected static IllegalStateException |
createMissingAttributeException(String attributeName) |
CloudEvent |
end() |
CloudEvent |
end(byte[] value) |
protected abstract void |
setAttributes(CloudEvent event) |
void |
setExtension(String name,
Boolean value) |
void |
setExtension(String name,
Number value) |
void |
setExtension(String name,
String value) |
SELF |
withData(byte[] 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,
URI dataSchema,
byte[] data)
Set the
datacontenttype, dataschema and data of the event |
SELF |
withExtension(Extension 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
|
SELF |
withExtension(String key,
Number value)
Set an extension with provided key and numeric value
|
SELF |
withExtension(String key,
String value)
Set an extension with provided key and string value
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuild, fromSpecVersion, newBuilder, v03, v03, v1, v1, withDataContentType, withDataSchema, withId, withSource, withSubject, withTime, withTypesetAttribute, setAttribute, setAttributepublic BaseCloudEventBuilder()
public BaseCloudEventBuilder(CloudEvent event)
protected abstract void setAttributes(CloudEvent 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 withExtension(@Nonnull String key, String value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull String key, Number value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull String key, boolean value)
CloudEventBuilderwithExtension in interface CloudEventBuilderkey - key of the extension attributevalue - value of the extension attributepublic SELF withExtension(@Nonnull Extension extension)
CloudEventBuilderwithExtension in interface CloudEventBuilderextension - materialized extension to set in the eventpublic void setExtension(String name, String value) throws CloudEventRWException
setExtension in interface CloudEventExtensionsWriterCloudEventRWExceptionpublic void setExtension(String name, Number value) throws CloudEventRWException
setExtension in interface CloudEventExtensionsWriterCloudEventRWExceptionpublic void setExtension(String name, Boolean value) throws CloudEventRWException
setExtension in interface CloudEventExtensionsWriterCloudEventRWExceptionpublic CloudEvent end(byte[] value) throws CloudEventRWException
end in interface CloudEventWriter<CloudEvent>CloudEventRWExceptionpublic CloudEvent end()
end in interface CloudEventWriter<CloudEvent>protected static IllegalStateException createMissingAttributeException(String attributeName)
Copyright © 2020. All rights reserved.