Interface BaseEvent


public interface BaseEvent

Base representation of an Event containing common fields to all Event Types.


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()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the Event.

      Returns:
      id
    • getNotificationType

      @NotNull @NotNull String getNotificationType()
      Returns:
      notificationType
    • getResourceType

      @NotNull @NotNull EventSubscriptionResourceTypeId getResourceType()

      The type of resource targeted by the Event.

      Returns:
      resourceType
    • getType

      @NotNull @NotNull EventType getType()

      The type of Event that has occurred.

      Returns:
      type
    • getData

      @NotNull @Valid @NotNull @Valid Object getData()

      An object containing details related to the Event.

      Returns:
      data
    • getCreatedAt

      @NotNull @NotNull ZonedDateTime getCreatedAt()

      Date and time (UTC) the Event was generated.

      Returns:
      createdAt
    • setId

      void setId(String id)

      Unique identifier of the Event.

      Parameters:
      id - value to be set
    • setNotificationType

      void setNotificationType(String notificationType)
      set notificationType
      Parameters:
      notificationType - value to be set
    • setResourceType

      void setResourceType(EventSubscriptionResourceTypeId resourceType)

      The type of resource targeted by the Event.

      Parameters:
      resourceType - value to be set
    • setType

      void setType(EventType type)

      The type of Event that has occurred.

      Parameters:
      type - value to be set
    • setData

      void setData(Object data)

      An object containing details related to the Event.

      Parameters:
      data - value to be set
    • setCreatedAt

      void setCreatedAt(ZonedDateTime createdAt)

      Date and time (UTC) the Event was generated.

      Parameters:
      createdAt - value to be set
    • of

      static BaseEvent of()
      factory method
      Returns:
      instance of BaseEvent
    • of

      static BaseEvent of(BaseEvent template)
      factory method to create a shallow copy BaseEvent
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • copyDeep

      BaseEvent copyDeep()
    • deepCopy

      @Nullable static BaseEvent deepCopy(@Nullable BaseEvent template)
      factory method to create a deep copy of BaseEvent
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static BaseEventBuilder builder()
      builder factory method for BaseEvent
      Returns:
      builder
    • builder

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

      default <T> T withBaseEvent(Function<BaseEvent,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<BaseEvent> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference