Class CustomerAggregate
java.lang.Object
com.brodygaudel.bank.command.aggregate.CustomerAggregate
Aggregate representing a customer in the system.
This aggregate captures the state changes of a customer, including creation, update, and deletion events. It applies the events and updates its internal state accordingly.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the CustomerAggregate.CustomerAggregate(@NotNull CreateCustomerCommand command) Constructor for handling theCreateCustomerCommandand applying the corresponding event. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(@NotNull DeleteCustomerCommand command) Command handler for handling theDeleteCustomerCommandand applying the corresponding event.voidhandle(@NotNull UpdateCustomerCommand command) Command handler for handling theUpdateCustomerCommandand applying the corresponding event.voidon(@NotNull CustomerCreatedEvent event) Event sourcing handler for theCustomerCreatedEvent.voidon(@NotNull CustomerDeletedEvent event) Event sourcing handler for theCustomerDeletedEvent.voidon(@NotNull CustomerUpdatedEvent event) Event sourcing handler for theCustomerUpdatedEvent.
-
Constructor Details
-
CustomerAggregate
public CustomerAggregate()Default constructor for the CustomerAggregate. -
CustomerAggregate
Constructor for handling theCreateCustomerCommandand applying the corresponding event.- Parameters:
command- TheCreateCustomerCommandto handle.
-
-
Method Details
-
on
Event sourcing handler for theCustomerCreatedEvent.- Parameters:
event- TheCustomerCreatedEventto handle.
-
handle
Command handler for handling theUpdateCustomerCommandand applying the corresponding event.- Parameters:
command- TheUpdateCustomerCommandto handle.
-
on
Event sourcing handler for theCustomerUpdatedEvent.- Parameters:
event- TheCustomerUpdatedEventto handle.
-
handle
Command handler for handling theDeleteCustomerCommandand applying the corresponding event.- Parameters:
command- TheDeleteCustomerCommandto handle.
-
on
Event sourcing handler for theCustomerDeletedEvent.- Parameters:
event- TheCustomerDeletedEventto handle.
-