Class AbstractEvent

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

public abstract class AbstractEvent extends Object implements org.fuin.ddd4j.core.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 org.fuin.ddd4j.core.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 org.fuin.ddd4j.core.EventId correlationId, @Nullable org.fuin.ddd4j.core.EventId causationId)
      Constructor with optional data.
      Parameters:
      correlationId - Correlation ID.
      causationId - ID of the event that caused this one.
  • Method Details

    • getEventId

      public final org.fuin.ddd4j.core.EventId getEventId()
      Specified by:
      getEventId in interface org.fuin.ddd4j.core.Event
    • getEventTimestamp

      public final ZonedDateTime getEventTimestamp()
      Specified by:
      getEventTimestamp in interface org.fuin.ddd4j.core.Event
    • getCorrelationId

      public final org.fuin.ddd4j.core.EventId getCorrelationId()
      Specified by:
      getCorrelationId in interface org.fuin.ddd4j.core.Event
    • getCausationId

      public final org.fuin.ddd4j.core.EventId getCausationId()
      Specified by:
      getCausationId in interface org.fuin.ddd4j.core.Event
    • hashCode

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

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