Package org.fuin.ddd4j.ddd
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractEvent.Builder<TYPE extends AbstractEvent,BUILDER extends AbstractEvent.Builder<TYPE,BUILDER>>Base class for event builders.
-
Constructor Summary
Constructors Constructor Description AbstractEvent()Default constructor.AbstractEvent(@NotNull Event respondTo)Constructor with event this one responds to.AbstractEvent(EventId correlationId, EventId causationId)Constructor with optional data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)EventIdgetCausationId()Causation identifier.EventIdgetCorrelationId()Correlation identifier.EventIdgetEventId()Returns the identifier of the event.ZonedDateTimegetEventTimestamp()Date, time and time zone the event was created.inthashCode()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.fuin.ddd4j.ddd.Event
getEventType
-
-
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
getEventId
public final EventId getEventId()
Description copied from interface:EventReturns the identifier of the event.- Specified by:
getEventIdin interfaceEvent- Returns:
- Unique identifier event.
-
getEventTimestamp
public final ZonedDateTime getEventTimestamp()
Description copied from interface:EventDate, time and time zone the event was created.- Specified by:
getEventTimestampin interfaceEvent- Returns:
- Event creation date and time.
-
getCorrelationId
public final EventId getCorrelationId()
Description copied from interface:EventCorrelation identifier.- Specified by:
getCorrelationIdin interfaceEvent- Returns:
- Context of the event.
-
getCausationId
public final EventId getCausationId()
Description copied from interface:EventCausation identifier.- Specified by:
getCausationIdin interfaceEvent- Returns:
- Identifier of the evtn that caused this one.
-
-