Class StoredEvent
java.lang.Object
com.reallifedeveloper.common.application.eventstore.StoredEvent
A representation of a
DomainEvent that can be stored in a database.- Author:
- RealLifeDeveloper
-
Constructor Summary
ConstructorsConstructorDescriptionStoredEvent(String eventType, String eventBody, ZonedDateTime occurredOn, int version) Creates a newStoredEventwith the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionGives the string representation of the domain event represented by thisStoredEvent.Gives the class name of the domain event represented by thisStoredEvent.@Nullable Longid()Gives the ID of thisStoredEvent.Gives the date and time the domain event represented by thisStoredEventoccurred.toString()version()Gives the version of the domain event represented by thisStoredEvent.
-
Constructor Details
-
StoredEvent
Creates a newStoredEventwith the given attributes.- Parameters:
eventType- the class name of the domain event, as given byevent.getClass().getName()eventBody- a string representation of the domain eventoccurredOn- the date and time the domain event occurredversion- the version of the domain event- Throws:
IllegalArgumentException- if any argument isnull
-
-
Method Details
-
id
Gives the ID of thisStoredEvent. Note that this is not the same as the ID of the domain event itself.- Returns:
- the ID of this
StoredEvent
-
eventType
Gives the class name of the domain event represented by thisStoredEvent.- Returns:
- the class name of the domain event
-
eventBody
Gives the string representation of the domain event represented by thisStoredEvent.- Returns:
- a string representation of the domain event
-
occurredOn
Gives the date and time the domain event represented by thisStoredEventoccurred.- Returns:
- the date and time the domain event occurred
-
version
Gives the version of the domain event represented by thisStoredEvent.- Returns:
- the version of the domain event
-
toString
-