Class CloudEventsPayloadBuilder

java.lang.Object
com.commercetools.api.models.subscription.CloudEventsPayloadBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<CloudEventsPayload>

public class CloudEventsPayloadBuilder extends Object implements io.vrap.rmf.base.client.Builder<CloudEventsPayload>
CloudEventsPayloadBuilder
Example to create an instance using the builder pattern

     CloudEventsPayload cloudEventsPayload = CloudEventsPayload.builder()
             .specversion("{specversion}")
             .id("{id}")
             .type("{type}")
             .source("{source}")
             .subject("{subject}")
             .time(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .data(dataBuilder -> dataBuilder)
             .build()
 
  • Constructor Details

  • Method Details

    • specversion

      The version of the CloudEvents specification which the event uses.

      Parameters:
      specversion - value to be set
      Returns:
      Builder
    • id

      Unique identifier of the event.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • type

      The type is namespaced with com.commercetools, followed by the ReferenceTypeId, the type of Subscription (either message or change), and the message or change type. For example, com.commercetools.product.message.ProductPublished or com.commercetools.order.change.ResourceCreated.

      Parameters:
      type - value to be set
      Returns:
      Builder
    • source

      The default REST URI of the ReferenceTypeId that triggered this event, including the project key.

      Parameters:
      source - value to be set
      Returns:
      Builder
    • subject

      Unique identifier of the resource that triggered the event.

      Parameters:
      subject - value to be set
      Returns:
      Builder
    • time

      Corresponds to the lastModifiedAt of the resource at the time the event was triggered.

      Parameters:
      time - value to be set
      Returns:
      Builder
    • sequence

      Corresponds to the sequenceNumber of a MessageSubscription. Can be used to process messages in the correct order.

      Parameters:
      sequence - value to be set
      Returns:
      Builder
    • sequencetype

      "Integer"

      Parameters:
      sequencetype - value to be set
      Returns:
      Builder
    • dataref

      The URI from which the message can be retrieved if messages are enabled. Only set for MessageSubscriptions.

      Parameters:
      dataref - value to be set
      Returns:
      Builder
    • data

      MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.

      Parameters:
      data - value to be set
      Returns:
      Builder
    • data

      public CloudEventsPayloadBuilder data(Function<DeliveryPayloadBuilder,io.vrap.rmf.base.client.Builder<? extends DeliveryPayload>> builder)

      MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.

      Parameters:
      builder - function to build the data value
      Returns:
      Builder
    • getSpecversion

      The version of the CloudEvents specification which the event uses.

      Returns:
      specversion
    • getId

      public String getId()

      Unique identifier of the event.

      Returns:
      id
    • getType

      public String getType()

      The type is namespaced with com.commercetools, followed by the ReferenceTypeId, the type of Subscription (either message or change), and the message or change type. For example, com.commercetools.product.message.ProductPublished or com.commercetools.order.change.ResourceCreated.

      Returns:
      type
    • getSource

      public String getSource()

      The default REST URI of the ReferenceTypeId that triggered this event, including the project key.

      Returns:
      source
    • getSubject

      public String getSubject()

      Unique identifier of the resource that triggered the event.

      Returns:
      subject
    • getTime

      Corresponds to the lastModifiedAt of the resource at the time the event was triggered.

      Returns:
      time
    • getSequence

      Corresponds to the sequenceNumber of a MessageSubscription. Can be used to process messages in the correct order.

      Returns:
      sequence
    • getSequencetype

      "Integer"

      Returns:
      sequencetype
    • getDataref

      The URI from which the message can be retrieved if messages are enabled. Only set for MessageSubscriptions.

      Returns:
      dataref
    • getData

      MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.

      Returns:
      data
    • build

      builds CloudEventsPayload with checking for non-null required values
      Specified by:
      build in interface io.vrap.rmf.base.client.Builder<CloudEventsPayload>
      Returns:
      CloudEventsPayload
    • buildUnchecked

      builds CloudEventsPayload without checking for non-null required values
      Returns:
      CloudEventsPayload
    • of

      public static CloudEventsPayloadBuilder of()
      factory method for an instance of CloudEventsPayloadBuilder
      Returns:
      builder
    • of

      create builder for CloudEventsPayload instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder