Package org.salespointframework.core
Class AbstractAggregateRoot<ID extends SalespointIdentifier>
java.lang.Object
org.salespointframework.core.AbstractEntity<ID>
org.salespointframework.core.AbstractAggregateRoot<ID>
- All Implemented Interfaces:
Persistable<ID>
- Direct Known Subclasses:
InventoryItem
,Order
,Product
,UserAccount
@MappedSuperclass public abstract class AbstractAggregateRoot<ID extends SalespointIdentifier> extends AbstractEntity<ID>
Base class for Aggregate root entities. It exposes a
registerEvent(Object)
method that allows sub-classes to
register events to be published as soon as the aggregates are persisted using calls to
CrudRepository.save(Object)
.- Since:
- 7.3
- Author:
- Oliver Drotbohm
- See Also:
- Publishing domain events from aggregate roots
-
Constructor Summary
Constructors Constructor Description AbstractAggregateRoot()
-
Method Summary
Modifier and Type Method Description protected <T> T
registerEvent(T event)
Registers the given event with the aggregate root for publication on persisting, i.e.Methods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, hasId, isNew
-
Constructor Details
-
AbstractAggregateRoot
public AbstractAggregateRoot()
-
-
Method Details
-
registerEvent
protected final <T> T registerEvent(T event)Registers the given event with the aggregate root for publication on persisting, i.e.CrudRepository.save(Object)
.- Type Parameters:
T
- the type of the event- Parameters:
event
- must not be null.- Returns:
-