Class MessageDeliveryPayloadBuilder

java.lang.Object
com.commercetools.api.models.subscription.MessageDeliveryPayloadBuilder
All Implemented Interfaces:
Builder<MessageDeliveryPayload>
Direct Known Subclasses:
MessageDeliveryBuilder

public class MessageDeliveryPayloadBuilder extends Object implements Builder<MessageDeliveryPayload>
MessageDeliveryPayloadBuilder
Example to create an instance using the builder pattern

     MessageDeliveryPayload messageDeliveryPayload = MessageDeliveryPayload.builder()
             .projectKey("{projectKey}")
             .resource(resourceBuilder -> resourceBuilder)
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .sequenceNumber(0.3)
             .resourceVersion(0.3)
             .build()
 
  • Constructor Details

    • MessageDeliveryPayloadBuilder

      public MessageDeliveryPayloadBuilder()
  • Method Details

    • projectKey

      public MessageDeliveryPayloadBuilder projectKey(String projectKey)

      key of the Project. Useful in message processing if the Destination receives events from multiple Projects.

      Parameters:
      projectKey - value to be set
      Returns:
      Builder
    • resource

      public MessageDeliveryPayloadBuilder resource(Reference resource)

      Reference to the resource that triggered the message.

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

      Reference to the resource that triggered the message.

      Parameters:
      builder - function to build the resource value
      Returns:
      Builder
    • resourceUserProvidedIdentifiers

      User-defined unique identifiers of the resource.

      Parameters:
      builder - function to build the resourceUserProvidedIdentifiers value
      Returns:
      Builder
    • withResourceUserProvidedIdentifiers

      User-defined unique identifiers of the resource.

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

      public MessageDeliveryPayloadBuilder resourceUserProvidedIdentifiers(@Nullable UserProvidedIdentifiers resourceUserProvidedIdentifiers)

      User-defined unique identifiers of the resource.

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

      Unique ID of the message.

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

      public MessageDeliveryPayloadBuilder version(Long version)

      Last seen version of the resource.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public MessageDeliveryPayloadBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the resource was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public MessageDeliveryPayloadBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the resource was last modified.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • sequenceNumber

      public MessageDeliveryPayloadBuilder sequenceNumber(Long sequenceNumber)

      Used to ensure all messages of the resource are processed in correct order. The sequenceNumber of the next message of the resource is a successor of the sequenceNumber of the current message.

      Parameters:
      sequenceNumber - value to be set
      Returns:
      Builder
    • resourceVersion

      public MessageDeliveryPayloadBuilder resourceVersion(Long resourceVersion)

      Version of the resource on which the change was performed.

      Parameters:
      resourceVersion - value to be set
      Returns:
      Builder
    • payloadNotIncluded

      If the payload does not fit into the size limit or its format is not accepted by the messaging service, the payloadNotIncluded field is present.

      Parameters:
      builder - function to build the payloadNotIncluded value
      Returns:
      Builder
    • withPayloadNotIncluded

      If the payload does not fit into the size limit or its format is not accepted by the messaging service, the payloadNotIncluded field is present.

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

      public MessageDeliveryPayloadBuilder payloadNotIncluded(@Nullable PayloadNotIncluded payloadNotIncluded)

      If the payload does not fit into the size limit or its format is not accepted by the messaging service, the payloadNotIncluded field is present.

      Parameters:
      payloadNotIncluded - value to be set
      Returns:
      Builder
    • getProjectKey

      public String getProjectKey()

      key of the Project. Useful in message processing if the Destination receives events from multiple Projects.

      Returns:
      projectKey
    • getResource

      public Reference getResource()

      Reference to the resource that triggered the message.

      Returns:
      resource
    • getResourceUserProvidedIdentifiers

      @Nullable public UserProvidedIdentifiers getResourceUserProvidedIdentifiers()

      User-defined unique identifiers of the resource.

      Returns:
      resourceUserProvidedIdentifiers
    • getId

      public String getId()

      Unique ID of the message.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Last seen version of the resource.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the resource was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the resource was last modified.

      Returns:
      lastModifiedAt
    • getSequenceNumber

      public Long getSequenceNumber()

      Used to ensure all messages of the resource are processed in correct order. The sequenceNumber of the next message of the resource is a successor of the sequenceNumber of the current message.

      Returns:
      sequenceNumber
    • getResourceVersion

      public Long getResourceVersion()

      Version of the resource on which the change was performed.

      Returns:
      resourceVersion
    • getPayloadNotIncluded

      @Nullable public PayloadNotIncluded getPayloadNotIncluded()

      If the payload does not fit into the size limit or its format is not accepted by the messaging service, the payloadNotIncluded field is present.

      Returns:
      payloadNotIncluded
    • build

      public MessageDeliveryPayload build()
      builds MessageDeliveryPayload with checking for non-null required values
      Specified by:
      build in interface Builder<MessageDeliveryPayload>
      Returns:
      MessageDeliveryPayload
    • buildUnchecked

      public MessageDeliveryPayload buildUnchecked()
      builds MessageDeliveryPayload without checking for non-null required values
      Returns:
      MessageDeliveryPayload
    • of

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

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