Interface CloudEventContextWriter

All Known Subinterfaces:
CloudEventWriter<R>

@ParametersAreNonnullByDefault public interface CloudEventContextWriter
Interface to write the context attributes/extensions from a CloudEventContextReader to a new representation.
  • Method Details

    • withContextAttribute

      CloudEventContextWriter withContextAttribute(String name, String value) throws CloudEventRWException
      Set attribute with type String. 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 attribute
      value - 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 type URI. 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 attribute
      value - 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 type OffsetDateTime attribute. 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 attribute
      value - 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 permits Integer type as a numeric value. Use withContextAttribute(String, Integer) instead.
      Set attribute with type Number. 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 attribute
      value - 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 type Integer. 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 attribute
      value - 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 type Boolean attribute. 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 attribute
      value - 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 attribute
      value - 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.