Class AbstractEvent

java.lang.Object
org.fuin.ddd4j.ddd.AbstractEvent
All Implemented Interfaces:
Serializable, Event
Direct Known Subclasses:
AbstractDomainEvent

public abstract class AbstractEvent extends Object implements Event
Base class for events. Equals and hash code are solely based on the event id.
See Also:
  • Constructor Details

    • AbstractEvent

      public AbstractEvent()
      Default constructor.
    • AbstractEvent

      public AbstractEvent(@NotNull @NotNull Event respondTo)
      Constructor with event this one responds to. Convenience method to set the correlation and causation identifiers correctly.
      Parameters:
      respondTo - Causing event.
    • AbstractEvent

      public AbstractEvent(@Nullable EventId correlationId, @Nullable EventId causationId)
      Constructor with optional data.
      Parameters:
      correlationId - Correlation ID.
      causationId - ID of the event that caused this one.
  • Method Details

    • getEventId

      public final EventId getEventId()
      Description copied from interface: Event
      Returns the identifier of the event.
      Specified by:
      getEventId in interface Event
      Returns:
      Unique identifier event.
    • getEventTimestamp

      public final ZonedDateTime getEventTimestamp()
      Description copied from interface: Event
      Date, time and time zone the event was created.
      Specified by:
      getEventTimestamp in interface Event
      Returns:
      Event creation date and time.
    • getCorrelationId

      public final EventId getCorrelationId()
      Description copied from interface: Event
      Correlation identifier.
      Specified by:
      getCorrelationId in interface Event
      Returns:
      Context of the event.
    • getCausationId

      public final EventId getCausationId()
      Description copied from interface: Event
      Causation identifier.
      Specified by:
      getCausationId in interface Event
      Returns:
      Identifier of the evtn that caused this one.
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object