Class AbstractAggregateCommand.Builder<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId,TYPE extends AbstractAggregateCommand<ROOT_ID,ENTITY_ID>,BUILDER extends AbstractCommand.Builder<ROOT_ID,TYPE,BUILDER>>

java.lang.Object
org.fuin.cqrs4j.AbstractCommand.Builder<ROOT_ID,TYPE,BUILDER>
org.fuin.cqrs4j.AbstractAggregateCommand.Builder<ROOT_ID,ENTITY_ID,TYPE,BUILDER>
Type Parameters:
ROOT_ID - Type of the aggregate identifier.
ENTITY_ID - Type of the entity identifier.
TYPE - Type of the event.
BUILDER - Type of the builder.
Enclosing class:
AbstractAggregateCommand<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId>

protected abstract static class AbstractAggregateCommand.Builder<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId,TYPE extends AbstractAggregateCommand<ROOT_ID,ENTITY_ID>,BUILDER extends AbstractCommand.Builder<ROOT_ID,TYPE,BUILDER>> extends AbstractCommand.Builder<ROOT_ID,TYPE,BUILDER>
Base class for event builders.
  • Constructor Details

    • Builder

      public Builder(TYPE delegate)
      Constructor with event.
      Parameters:
      delegate - Event to populate with data.
  • Method Details

    • entityIdPath

      public final BUILDER entityIdPath(@NotNull @NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath)
      Sets the identifier path from aggregate root to the entity that emitted the event.
      Parameters:
      entityIdPath - Path of entity identifiers.
      Returns:
      This builder.
    • entityIdPath

      public final BUILDER entityIdPath(@NotNull @NotNull org.fuin.ddd4j.ddd.AggregateRootId id)
      Convenience method to set the entity identifier path if the path has only the aggregate root identifier.
      Parameters:
      id - Aggregate root identifier that will be used to create the entity id path.
      Returns:
      This builder.
    • aggregateVersion

      public final BUILDER aggregateVersion(@Nullable org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion)
      Sets the expected aggregate version.
      Parameters:
      aggregateVersion - Expected aggregate version..
      Returns:
      This builder.
    • ensureBuildableAbstractAggregateCommand

      protected final void ensureBuildableAbstractAggregateCommand()
      Ensures that everything is setup for building the object or throws a runtime exception otherwise.
    • resetAbstractAggregateCommand

      protected final void resetAbstractAggregateCommand(TYPE delegate)
      Sets the internal instance to a new one. This must be called within the build method.
      Parameters:
      delegate - Delegate to use.