java.lang.Object
org.fuin.ddd4j.ddd.AbstractEvent
- All Implemented Interfaces:
Serializable,Event
- Direct Known Subclasses:
AbstractDomainEvent
Base class for events. Equals and hash code are solely based on the event id.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAbstractEvent.Builder<TYPE extends AbstractEvent,BUILDER extends AbstractEvent.Builder<TYPE, BUILDER>> Base class for event builders. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AbstractEvent(@NotNull Event respondTo) Constructor with event this one responds to.AbstractEvent(EventId correlationId, EventId causationId) Constructor with optional data. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfinal EventIdCausation identifier.final EventIdCorrelation identifier.final EventIdReturns the identifier of the event.final ZonedDateTimeDate, time and time zone the event was created.final inthashCode()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.fuin.ddd4j.ddd.Event
getEventType
-
Constructor Details
-
AbstractEvent
public AbstractEvent()Default constructor. -
AbstractEvent
Constructor with event this one responds to. Convenience method to set the correlation and causation identifiers correctly.- Parameters:
respondTo- Causing event.
-
AbstractEvent
Constructor with optional data.- Parameters:
correlationId- Correlation ID.causationId- ID of the event that caused this one.
-
-
Method Details
-
getEventId
Description copied from interface:EventReturns the identifier of the event.- Specified by:
getEventIdin interfaceEvent- Returns:
- Unique identifier event.
-
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
Description copied from interface:EventCorrelation identifier.- Specified by:
getCorrelationIdin interfaceEvent- Returns:
- Context of the event.
-
getCausationId
Description copied from interface:EventCausation identifier.- Specified by:
getCausationIdin interfaceEvent- Returns:
- Identifier of the evtn that caused this one.
-
hashCode
public final int hashCode() -
equals
-