Module org.fuin.ddd4j
Package org.fuin.ddd4j.ddd
Class AbstractDomainEvent.Builder<ID extends EntityId,TYPE extends AbstractDomainEvent<ID>,BUILDER extends AbstractDomainEvent.Builder<ID,TYPE,BUILDER>>
java.lang.Object
org.fuin.ddd4j.ddd.AbstractEvent.Builder<TYPE,BUILDER>
org.fuin.ddd4j.ddd.AbstractDomainEvent.Builder<ID,TYPE,BUILDER>
- Type Parameters:
ID- Type of the entity identifier.TYPE- Type of the event.BUILDER- Type of the builder.
- Enclosing class:
- AbstractDomainEvent<ID extends EntityId>
protected abstract static class AbstractDomainEvent.Builder<ID extends EntityId,TYPE extends AbstractDomainEvent<ID>,BUILDER extends AbstractDomainEvent.Builder<ID,TYPE,BUILDER>>
extends AbstractEvent.Builder<TYPE,BUILDER>
Base class for event builders.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal BUILDERaggregateVersion(AggregateVersion aggregateVersion) Sets the aggregate version.protected final voidEnsures that everything is setup for building the object or throws a runtime exception otherwise.final BUILDERentityIdPath(@NotNull AggregateRootId id) Convenience method to set the entity identifier path if the path has only the aggregate root identifer.final BUILDERentityIdPath(@NotNull EntityIdPath entityIdPath) Sets the identifier path from aggregate root to the entity that emitted the event.protected final voidresetAbstractDomainEvent(TYPE delegate) Sets the internal instance to a new one.Methods inherited from class org.fuin.ddd4j.ddd.AbstractEvent.Builder
causationId, causingEvent, correlationId, delegate, ensureBuildableAbstractEvent, ensureNotNull, eventId, resetAbstractEvent, timestamp
-
Constructor Details
-
Builder
Constructor with event.- Parameters:
delegate- Event to populate with data.
-
-
Method Details
-
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
Convenience method to set the entity identifier path if the path has only the aggregate root identifer.- Parameters:
id- Aggregate root identifier that will be used to create the entity id path.- Returns:
- This builder.
-
aggregateVersion
Sets the aggregate version.- Parameters:
aggregateVersion- Aggregate version.- Returns:
- This builder.
-
ensureBuildableAbstractDomainEvent
protected final void ensureBuildableAbstractDomainEvent()Ensures that everything is setup for building the object or throws a runtime exception otherwise. -
resetAbstractDomainEvent
Sets the internal instance to a new one. This must be called within the build method.- Parameters:
delegate- Delegate to use.
-