View Javadoc
1   package com.reallifedeveloper.common.domain.event;
2   
3   import java.time.ZonedDateTime;
4   
5   import com.reallifedeveloper.common.domain.DomainObject;
6   
7   /**
8    * A domain-driven design domain event, i.e., something that happened that domain experts care about.
9    *
10   * @author RealLifeDeveloper
11   */
12  public interface DomainEvent extends DomainObject<DomainEvent> {
13  
14      /**
15       * Gives the time the event occurred.
16       *
17       * @return the time the event occurred
18       */
19      ZonedDateTime eventOccurredOn();
20  
21      /**
22       * Gives the version of this event. This is useful when deserializing an event.
23       * <p>
24       * The version should start at 1 and be incremented each time the event class is updated in a way
25       * that affects serialization/deserialization.
26       *
27       * @return the version of this event
28       */
29      int eventVersion();
30  
31  }