Interface PersistedRoot<T>

Type Parameters:
T - underlying domain value type
All Superinterfaces:
Entity<T>
All Known Subinterfaces:
AggregateRoot<T>, ModelRoot<T>
All Known Implementing Classes:
ImmutableAggregateRoot, ImmutableModelRoot, ImmutableRoot, LazyAggregateRoot, ModifiableAggregateRoot

public interface PersistedRoot<T> extends Entity<T>
Shared revision contract for an independently persisted Aggregate or Model root.
  • Method Details

    • parent

      default Entity<?> parent()
      Description copied from interface: Entity
      Retrieves the parent entity of the current entity.
      Specified by:
      parent in interface Entity<T>
      Returns:
      the parent entity of the current entity, or null if this entity does not have a parent
    • lastEventId

      String lastEventId()
      Description copied from interface: Entity
      Retrieves the identifier of the last event applied to the entity hierarchy.
      Specified by:
      lastEventId in interface Entity<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: Entity
      Retrieves the index of the last event applied to this entity hierarchy.
      Specified by:
      lastEventIndex in interface Entity<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

      Entity<T> withEventIndex(Long index, String messageId)
      Description copied from interface: Entity
      Updates the event index and message ID of the entity and returns the updated version of the entity.
      Specified by:
      withEventIndex in interface Entity<T>
      Parameters:
      index - the event index to set for the root entity
      messageId - 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: Entity
      Retrieves the sequence number of the current entity.
      Specified by:
      sequenceNumber in interface Entity<T>
      Returns:
      the sequence number of the root entity
    • withSequenceNumber

      Entity<T> withSequenceNumber(long sequenceNumber)
      Description copied from interface: Entity
      Returns an updated entity based on this with the specified sequence number.
      Specified by:
      withSequenceNumber in interface Entity<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

      Instant timestamp()
      Description copied from interface: Entity
      Retrieves the timestamp of the entity.
      Specified by:
      timestamp in interface Entity<T>
      Returns:
      the timestamp as an Instant obtained from the root entity
    • previous

      Entity<T> previous()
      Description copied from interface: Entity
      Retrieves the previous version of this entity.
      Specified by:
      previous in interface Entity<T>
      Returns:
      the previous state of the entity, or null if this is the first known version