Module io.cloudevents.core
Package io.cloudevents.core.impl
Class BaseCloudEventBuilder<SELF extends BaseCloudEventBuilder<SELF,T>,T extends io.cloudevents.CloudEvent>
java.lang.Object
io.cloudevents.core.impl.BaseCloudEventBuilder<SELF,T>
- All Implemented Interfaces:
CloudEventBuilder,io.cloudevents.rw.CloudEventContextWriter,io.cloudevents.rw.CloudEventWriter<io.cloudevents.CloudEvent>
- Direct Known Subclasses:
CloudEventBuilder,CloudEventBuilder
public abstract class BaseCloudEventBuilder<SELF extends BaseCloudEventBuilder<SELF,T>,T extends io.cloudevents.CloudEvent>
extends Object
implements CloudEventBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.cloudevents.CloudEventData -
Constructor Summary
ConstructorsConstructorDescriptionBaseCloudEventBuilder(io.cloudevents.CloudEvent event) BaseCloudEventBuilder(io.cloudevents.CloudEventContext context) -
Method Summary
Modifier and TypeMethodDescriptionprotected static IllegalStateExceptioncreateEmptyAttributeException(String attributeName) protected static IllegalStateExceptioncreateMissingAttributeException(String attributeName) io.cloudevents.CloudEventend()io.cloudevents.CloudEventend(io.cloudevents.CloudEventData value) protected voidprotected abstract voidsetAttributes(io.cloudevents.CloudEventContext event) withData(byte[] data) Set thedataof the eventwithData(io.cloudevents.CloudEventData data) Set thedataof the eventSet thedatacontenttypeanddataof the eventSet thedatacontenttypeanddataof the eventSet thedatacontenttype,dataschemaanddataof the eventSet thedatacontenttype,dataschemaanddataof the eventwithExtension(io.cloudevents.CloudEventExtension extension) Add to the builder all the extension key/values of the provided extensionwithExtension(String key, byte[] value) Set an extension with provided key and binary valuewithExtension(String key, Boolean value) Set an extension with provided key and boolean valuewithExtension(String key, Integer value) withExtension(String key, Number value) Set an extension with provided key and numeric valuewithExtension(String key, String value) Set an extension with provided key and string valuewithExtension(String key, URI value) Set an extension with provided key and uri valuewithExtension(String key, OffsetDateTime value) Set an extension with provided key and boolean valueRemove thedatacontenttype,dataschemaanddatafrom the eventRemove thedatacontenttypefrom the eventRemove thedataschemafrom the eventwithoutExtension(io.cloudevents.CloudEventExtension extension) Remove from the the builder the provided extension, if anywithoutExtension(String key) Remove from the the builder the provided extension key, if anyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.cloudevents.core.builder.CloudEventBuilder
build, newBuilder, withDataContentType, withDataSchema, withId, withSource, withSubject, withTime, withTypeMethods inherited from interface io.cloudevents.rw.CloudEventContextWriter
withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute, withContextAttribute
-
Field Details
-
data
protected io.cloudevents.CloudEventData data -
extensions
-
-
Constructor Details
-
BaseCloudEventBuilder
public BaseCloudEventBuilder() -
BaseCloudEventBuilder
public BaseCloudEventBuilder(io.cloudevents.CloudEventContext context) -
BaseCloudEventBuilder
public BaseCloudEventBuilder(io.cloudevents.CloudEvent event)
-
-
Method Details
-
setAttributes
protected abstract void setAttributes(io.cloudevents.CloudEventContext event) -
withData
Description copied from interface:CloudEventBuilderSet thedataof the event- Specified by:
withDatain interfaceCloudEventBuilder- Parameters:
data- data of the event- Returns:
- self
-
withData
Description copied from interface:CloudEventBuilderSet thedatacontenttypeanddataof the event- Specified by:
withDatain interfaceCloudEventBuilder- Parameters:
dataContentType- datacontenttype of the eventdata- data of the event- Returns:
- self
-
withData
Description copied from interface:CloudEventBuilderSet thedatacontenttype,dataschemaanddataof the event- Specified by:
withDatain interfaceCloudEventBuilder- Parameters:
dataContentType- datacontenttype of the eventdataSchema- dataschema of the eventdata- data of the event- Returns:
- self
-
withData
Description copied from interface:CloudEventBuilderSet thedataof the event- Specified by:
withDatain interfaceCloudEventBuilder- Parameters:
data- data of the event- Returns:
- self
-
withData
Description copied from interface:CloudEventBuilderSet thedatacontenttypeanddataof the event- Specified by:
withDatain interfaceCloudEventBuilder- Parameters:
dataContentType- datacontenttype of the eventdata- data of the event- Returns:
- self
-
withData
Description copied from interface:CloudEventBuilderSet thedatacontenttype,dataschemaanddataof the event- Specified by:
withDatain interfaceCloudEventBuilder- Parameters:
dataContentType- datacontenttype of the eventdataSchema- dataschema of the eventdata- data of the event- Returns:
- self
-
withoutData
Description copied from interface:CloudEventBuilderRemove thedatacontenttype,dataschemaanddatafrom the event- Specified by:
withoutDatain interfaceCloudEventBuilder- Returns:
- self
-
withoutDataSchema
Description copied from interface:CloudEventBuilderRemove thedataschemafrom the event- Specified by:
withoutDataSchemain interfaceCloudEventBuilder- Returns:
- self
-
withoutDataContentType
Description copied from interface:CloudEventBuilderRemove thedatacontenttypefrom the event- Specified by:
withoutDataContentTypein interfaceCloudEventBuilder- Returns:
- self
-
withExtension
Description copied from interface:CloudEventBuilderSet an extension with provided key and string value- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attributevalue- value of the extension attribute- Returns:
- self
-
withExtension
Description copied from interface:CloudEventBuilderSet an extension with provided key and numeric value- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attributevalue- value of the extension attribute- Returns:
- self
-
withExtension
-
withExtension
Description copied from interface:CloudEventBuilderSet an extension with provided key and boolean value- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attributevalue- value of the extension attribute- Returns:
- self
-
withExtension
Description copied from interface:CloudEventBuilderSet an extension with provided key and uri value- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attributevalue- value of the extension attribute- Returns:
- self
-
withExtension
Description copied from interface:CloudEventBuilderSet an extension with provided key and boolean value- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attributevalue- value of the extension attribute- Returns:
- self
-
withExtension
Description copied from interface:CloudEventBuilderSet an extension with provided key and binary value- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attributevalue- value of the extension attribute- Returns:
- self
-
withoutExtension
Description copied from interface:CloudEventBuilderRemove from the the builder the provided extension key, if any- Specified by:
withoutExtensionin interfaceCloudEventBuilder- Parameters:
key- key of the extension attribute- Returns:
- self
-
withoutExtension
Description copied from interface:CloudEventBuilderRemove from the the builder the provided extension, if any- Specified by:
withoutExtensionin interfaceCloudEventBuilder- Parameters:
extension- materialized extension to remove from the builder- Returns:
- self
-
withExtension
Description copied from interface:CloudEventBuilderAdd to the builder all the extension key/values of the provided extension- Specified by:
withExtensionin interfaceCloudEventBuilder- Parameters:
extension- materialized extension to set in the builder- Returns:
- self
-
end
public io.cloudevents.CloudEvent end(io.cloudevents.CloudEventData value) throws io.cloudevents.rw.CloudEventRWException - Specified by:
endin interfaceio.cloudevents.rw.CloudEventWriter<SELF extends BaseCloudEventBuilder<SELF,T>> - Throws:
io.cloudevents.rw.CloudEventRWException
-
end
public io.cloudevents.CloudEvent end()- Specified by:
endin interfaceio.cloudevents.rw.CloudEventWriter<SELF extends BaseCloudEventBuilder<SELF,T>>
-
createMissingAttributeException
-
createEmptyAttributeException
-
requireValidAttributeWrite
-