- All Known Subinterfaces:
CloudEventWriter<R>
@ParametersAreNonnullByDefault
public interface CloudEventContextWriter
Interface to write the context attributes/extensions from a
CloudEventContextReader to a new representation.-
Method Summary
Modifier and TypeMethodDescriptiondefault CloudEventContextWriterwithContextAttribute(String name, byte[] value) Set the attribute with a binary type.default CloudEventContextWriterwithContextAttribute(String name, Boolean value) Set attribute with typeBooleanattribute.default CloudEventContextWriterwithContextAttribute(String name, Integer value) Set attribute with typeInteger.default CloudEventContextWriterwithContextAttribute(String name, Number value) Deprecated.withContextAttribute(String name, String value) Set attribute with typeString.default CloudEventContextWriterwithContextAttribute(String name, URI value) Set attribute with typeURI.default CloudEventContextWriterwithContextAttribute(String name, OffsetDateTime value) Set attribute with typeOffsetDateTimeattribute.
-
Method Details
-
withContextAttribute
CloudEventContextWriter withContextAttribute(String name, String value) throws CloudEventRWException Set attribute with typeString. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this attribute.IllegalArgumentException- if you're trying to set the specversion attribute.
-
withContextAttribute
default CloudEventContextWriter withContextAttribute(String name, URI value) throws CloudEventRWException Set attribute with typeURI. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this attribute.IllegalArgumentException- if you're trying to set the specversion attribute.
-
withContextAttribute
default CloudEventContextWriter withContextAttribute(String name, OffsetDateTime value) throws CloudEventRWException Set attribute with typeOffsetDateTimeattribute. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this attribute.IllegalArgumentException- if you're trying to set the specversion attribute.
-
withContextAttribute
@Deprecated default CloudEventContextWriter withContextAttribute(String name, Number value) throws CloudEventRWException Deprecated.CloudEvent specification only permitsIntegertype as a numeric value. UsewithContextAttribute(String, Integer)instead.Set attribute with typeNumber. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this extension.IllegalArgumentException- if you're trying to set the specversion attribute.
-
withContextAttribute
default CloudEventContextWriter withContextAttribute(String name, Integer value) throws CloudEventRWException Set attribute with typeInteger. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this extension.IllegalArgumentException- if you're trying to set the specversion attribute.
-
withContextAttribute
default CloudEventContextWriter withContextAttribute(String name, Boolean value) throws CloudEventRWException Set attribute with typeBooleanattribute. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this extension.IllegalArgumentException- if you're trying to set the specversion attribute.
-
withContextAttribute
default CloudEventContextWriter withContextAttribute(String name, byte[] value) throws CloudEventRWException Set the attribute with a binary type. This setter should not be invoked for specversion, because the writer should already know the specversion or because it doesn't need it to correctly write the value.- Parameters:
name- name of the attributevalue- value of the attribute- Returns:
- self
- Throws:
CloudEventRWException- if anything goes wrong while writing this extension.IllegalArgumentException- if you're trying to set the specversion attribute.
-
Integertype as a numeric value.