Class AccountAggregate
java.lang.Object
com.brodygaudel.bank.command.aggregate.AccountAggregate
Aggregate representing an account in the system.
This aggregate captures the state changes of an account, including creation, activation, suspension, credit, and debit events. It applies the events and updates its internal state accordingly.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the AccountAggregate.AccountAggregate(@NotNull CreateAccountCommand command) Constructor for handling theCreateAccountCommandand applying the corresponding event. -
Method Summary
Modifier and TypeMethodDescriptionvoidon(@NotNull ActiveAccountCommand command) Command handler for handling theActiveAccountCommandand applying the corresponding event.voidon(@NotNull CreditAccountCommand command) Command handler for handling theCreditAccountCommandand applying the corresponding event.voidon(@NotNull SuspendAccountCommand command) Command handler for handling theSuspendAccountCommandand applying the corresponding event.voidon(@NotNull AccountActivatedEvent event) Event sourcing handler for theAccountActivatedEvent.voidon(@NotNull AccountCreatedEvent event) Event sourcing handler for theAccountCreatedEvent.voidon(@NotNull AccountCreditedEvent event) Event sourcing handler for theAccountCreditedEvent.voidon(@NotNull AccountDebitedEvent event) Event sourcing handler for theAccountDebitedEvent.voidon(@NotNull AccountSuspendedEvent event) Event sourcing handler for theAccountSuspendedEvent.voidon(DebitAccountCommand command) Command handler for handling theDebitAccountCommandand applying the corresponding event.
-
Constructor Details
-
AccountAggregate
public AccountAggregate()Default constructor for the AccountAggregate. -
AccountAggregate
Constructor for handling theCreateAccountCommandand applying the corresponding event.- Parameters:
command- TheCreateAccountCommandto handle.
-
-
Method Details
-
on
Event sourcing handler for theAccountCreatedEvent.- Parameters:
event- TheAccountCreatedEventto handle.
-
on
Command handler for handling theDebitAccountCommandand applying the corresponding event.- Parameters:
command- TheDebitAccountCommandto handle.
-
on
Event sourcing handler for theAccountDebitedEvent.- Parameters:
event- TheAccountDebitedEventto handle.
-
on
Command handler for handling theCreditAccountCommandand applying the corresponding event.- Parameters:
command- TheCreditAccountCommandto handle.
-
on
Event sourcing handler for theAccountCreditedEvent.- Parameters:
event- TheAccountCreditedEventto handle.
-
on
Command handler for handling theActiveAccountCommandand applying the corresponding event.- Parameters:
command- TheActiveAccountCommandto handle.
-
on
Event sourcing handler for theAccountActivatedEvent.- Parameters:
event- TheAccountActivatedEventto handle.
-
on
Command handler for handling theSuspendAccountCommandand applying the corresponding event.- Parameters:
command- TheSuspendAccountCommandto handle.
-
on
Event sourcing handler for theAccountSuspendedEvent.- Parameters:
event- TheAccountSuspendedEventto handle.
-