Interface AggregateRoot<T>
- Type Parameters:
T- the type of the underlying domain object
- All Superinterfaces:
Entity<T>, PersistedRoot<T>
- All Known Implementing Classes:
ImmutableAggregateRoot, LazyAggregateRoot, ModifiableAggregateRoot
Represents the root of a legacy aggregate in a domain model.
This compatibility specialization retains aggregate vocabulary while the shared persisted-root contract lives in
PersistedRoot. Existing aggregate implementations and callers remain valid.
- See Also:
-
Field Summary
Fields inherited from interface Entity
AGGREGATE_ID_METADATA_KEY, AGGREGATE_SN_METADATA_KEY, AGGREGATE_TYPE_METADATA_KEY, ALREADY_EXISTS_EXCEPTION, applying, loading, NOT_FOUND_EXCEPTION -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the identifier of the last event applied to the entity hierarchy.Retrieves the index of the last event applied to this entity hierarchy.default Entity<?> parent()Retrieves the parent entity of the current entity.previous()Retrieves the previous version of this entity.longRetrieves the sequence number of the current entity.Retrieves the timestamp of the entity.withEventIndex(Long index, String messageId) Updates the event index and message ID of the entity and returns the updated version of the entity.withSequenceNumber(long sequenceNumber) Returns an updated entity based on this with the specified sequence number.Methods inherited from interface Entity
aliases, allEntities, ancestors, ancestorValue, apply, apply, apply, apply, apply, apply, assertAndApply, assertAndApply, assertAndApply, assertAndApply, assertLegal, associations, commit, depth, dissociations, entities, filterEntity, filterPresent, findEntity, get, getEntity, getEntity, highestEventIndex, id, idProperty, ifPresent, isEmpty, isPresent, isRoot, map, mapEntity, mapIfPresent, orElse, orElseGet, orElseThrow, orElseThrow, playBackToCondition, playBackToEvent, possibleTargets, relationships, root, rootAnnotation, rootConfiguration, type, update, withType
-
Method Details
-
parent
Description copied from interface:EntityRetrieves the parent entity of the current entity. -
lastEventId
String lastEventId()Description copied from interface:EntityRetrieves the identifier of the last event applied to the entity hierarchy.- Specified by:
lastEventIdin interfaceEntity<T>- Specified by:
lastEventIdin interfacePersistedRoot<T>- Returns:
- the identifier of the last event as a string, or null if no events have been recorded in the entity's aggregate
-
lastEventIndex
Long lastEventIndex()Description copied from interface:EntityRetrieves the index of the last event applied to this entity hierarchy.- Specified by:
lastEventIndexin interfaceEntity<T>- Specified by:
lastEventIndexin interfacePersistedRoot<T>- Returns:
- the index of the last event as a
Long, or null if no events have been recorded for the entity's aggregate
-
withEventIndex
Description copied from interface:EntityUpdates the event index and message ID of the entity and returns the updated version of the entity.- Specified by:
withEventIndexin interfaceEntity<T>- Specified by:
withEventIndexin interfacePersistedRoot<T>- Parameters:
index- the event index to set for the root entitymessageId- the message ID associated with the event- Returns:
- the updated entity corresponding to the current entity's ID and type, or null if no such entity can be found
-
sequenceNumber
long sequenceNumber()Description copied from interface:EntityRetrieves the sequence number of the current entity.- Specified by:
sequenceNumberin interfaceEntity<T>- Specified by:
sequenceNumberin interfacePersistedRoot<T>- Returns:
- the sequence number of the root entity
-
withSequenceNumber
Description copied from interface:EntityReturns an updated entity based on this with the specified sequence number.- Specified by:
withSequenceNumberin interfaceEntity<T>- Specified by:
withSequenceNumberin interfacePersistedRoot<T>- Parameters:
sequenceNumber- the sequence number to assign to the entity- Returns:
- the updated entity with the specified sequence number, or null if the entity could not be found in the entity hierarchy
-
timestamp
-
previous
-