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 for processing notifications if the Destination receives them from multiple Projects.

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

      public MessageDeliveryPayloadBuilder resource(Reference resource)

      Reference to the resource that triggered the notification.

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

      Reference to the resource that triggered the notification.

      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 update was performed.

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

      Present when the payload exceeds the size limit of the message queue (the limit is often 256 KB) or its format is not accepted by the messaging service. If the payload exceeds the size limit, the additional Message fields are replaced with a PayloadNotIncluded object. You can retrieve the full Message using the Messages API if the feature is enabled.

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

      Present when the payload exceeds the size limit of the message queue (the limit is often 256 KB) or its format is not accepted by the messaging service. If the payload exceeds the size limit, the additional Message fields are replaced with a PayloadNotIncluded object. You can retrieve the full Message using the Messages API if the feature is enabled.

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

      public MessageDeliveryPayloadBuilder payloadNotIncluded(@Nullable PayloadNotIncluded payloadNotIncluded)

      Present when the payload exceeds the size limit of the message queue (the limit is often 256 KB) or its format is not accepted by the messaging service. If the payload exceeds the size limit, the additional Message fields are replaced with a PayloadNotIncluded object. You can retrieve the full Message using the Messages API if the feature is enabled.

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

      public String getProjectKey()

      key of the Project. Useful for processing notifications if the Destination receives them from multiple Projects.

      Returns:
      projectKey
    • getResource

      public Reference getResource()

      Reference to the resource that triggered the notification.

      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 update was performed.

      Returns:
      resourceVersion
    • getPayloadNotIncluded

      @Nullable public PayloadNotIncluded getPayloadNotIncluded()

      Present when the payload exceeds the size limit of the message queue (the limit is often 256 KB) or its format is not accepted by the messaging service. If the payload exceeds the size limit, the additional Message fields are replaced with a PayloadNotIncluded object. You can retrieve the full Message using the Messages API if the feature is enabled.

      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