Class BaseEventBuilder

java.lang.Object
com.commercetools.api.models.event.BaseEventBuilder
All Implemented Interfaces:
Builder<BaseEvent>

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

     BaseEvent baseEvent = BaseEvent.builder()
             .id("{id}")
             .notificationType("{notificationType}")
             .resourceType(EventSubscriptionResourceTypeId.CHECKOUT)
             .type(EventType.CHECKOUT_ORDER_CREATION_FAILED)
             .data(dataBuilder -> dataBuilder)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .build()
 
  • Constructor Details

    • BaseEventBuilder

      public BaseEventBuilder()
  • Method Details

    • id

      public BaseEventBuilder id(String id)

      Unique identifier of the Event.

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

      public BaseEventBuilder notificationType(String notificationType)
      set the value to the notificationType
      Parameters:
      notificationType - value to be set
      Returns:
      Builder
    • resourceType

      public BaseEventBuilder resourceType(EventSubscriptionResourceTypeId resourceType)

      The type of resource targeted by the Event.

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

      public BaseEventBuilder type(EventType type)

      The type of Event that has occurred.

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

      public BaseEventBuilder data(Object data)

      An object containing details related to the Event.

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

      public BaseEventBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Event was generated.

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

      public String getId()

      Unique identifier of the Event.

      Returns:
      id
    • getNotificationType

      public String getNotificationType()
      value of notificationType}
      Returns:
      notificationType
    • getResourceType

      public EventSubscriptionResourceTypeId getResourceType()

      The type of resource targeted by the Event.

      Returns:
      resourceType
    • getType

      public EventType getType()

      The type of Event that has occurred.

      Returns:
      type
    • getData

      public Object getData()

      An object containing details related to the Event.

      Returns:
      data
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Event was generated.

      Returns:
      createdAt
    • build

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

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

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

      public static BaseEventBuilder of(BaseEvent template)
      create builder for BaseEvent instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder