Class AccountAggregate

java.lang.Object
com.brodygaudel.bank.command.aggregate.AccountAggregate

public class AccountAggregate extends Object
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 Details

    • AccountAggregate

      public AccountAggregate()
      Default constructor for the AccountAggregate.
    • AccountAggregate

      @CommandHandler public AccountAggregate(@NotNull @NotNull CreateAccountCommand command)
      Constructor for handling the CreateAccountCommand and applying the corresponding event.
      Parameters:
      command - The CreateAccountCommand to handle.
  • Method Details

    • on

      @EventSourcingHandler public void on(@NotNull @NotNull AccountCreatedEvent event)
      Event sourcing handler for the AccountCreatedEvent.
      Parameters:
      event - The AccountCreatedEvent to handle.
    • on

      @CommandHandler public void on(DebitAccountCommand command)
      Command handler for handling the DebitAccountCommand and applying the corresponding event.
      Parameters:
      command - The DebitAccountCommand to handle.
    • on

      @EventSourcingHandler public void on(@NotNull @NotNull AccountDebitedEvent event)
      Event sourcing handler for the AccountDebitedEvent.
      Parameters:
      event - The AccountDebitedEvent to handle.
    • on

      @CommandHandler public void on(@NotNull @NotNull CreditAccountCommand command)
      Command handler for handling the CreditAccountCommand and applying the corresponding event.
      Parameters:
      command - The CreditAccountCommand to handle.
    • on

      @EventSourcingHandler public void on(@NotNull @NotNull AccountCreditedEvent event)
      Event sourcing handler for the AccountCreditedEvent.
      Parameters:
      event - The AccountCreditedEvent to handle.
    • on

      @CommandHandler public void on(@NotNull @NotNull ActiveAccountCommand command)
      Command handler for handling the ActiveAccountCommand and applying the corresponding event.
      Parameters:
      command - The ActiveAccountCommand to handle.
    • on

      @EventSourcingHandler public void on(@NotNull @NotNull AccountActivatedEvent event)
      Event sourcing handler for the AccountActivatedEvent.
      Parameters:
      event - The AccountActivatedEvent to handle.
    • on

      @CommandHandler public void on(@NotNull @NotNull SuspendAccountCommand command)
      Command handler for handling the SuspendAccountCommand and applying the corresponding event.
      Parameters:
      command - The SuspendAccountCommand to handle.
    • on

      @EventSourcingHandler public void on(@NotNull @NotNull AccountSuspendedEvent event)
      Event sourcing handler for the AccountSuspendedEvent.
      Parameters:
      event - The AccountSuspendedEvent to handle.