toStateEvent

fun <S : Any> DomainEventStream.toStateEvent(state: S, firstOperator: String = header.operator.orEmpty(), firstEventTime: Long = createTime, deleted: Boolean = false): StateEvent<S>

Converts a DomainEventStream to a StateEvent with the given state.

Return

a StateEvent wrapping this domain event stream

Parameters

state

the state of the aggregate

firstOperator

the first operator (default: from header)

firstEventTime

the first event time (default: createTime)

deleted

whether the aggregate is deleted (default: false)


Converts a DomainEventStream to a StateEvent using the state from a ReadOnlyStateAggregate.

Return

a StateEvent wrapping this domain event stream

Parameters

stateAggregate

the state aggregate to extract state from