nextEvent
Retrieves the next event and validates its type using KClass.
This method advances the iterator and ensures the next event's body is of the expected type.
Return
the next DomainEvent with the validated type
Parameters
the expected type of the event body
the KClass representing the expected event body type
Throws
if there is no next event or the event type doesn't match
Retrieves the next event and validates its type using Class.
This method advances the iterator and ensures the next event's body is of the expected type. Java-friendly overload using Class instead of KClass.
Return
the next DomainEvent with the validated type
Parameters
the expected type of the event body
the Class representing the expected event body type
Throws
if there is no next event or the event type doesn't match
Retrieves the next event with reified type validation.
This inline method uses reified generics to automatically infer the event type, providing a convenient way to get typed events without explicit type parameters.
Return
the next DomainEvent with the validated type
Parameters
the expected type of the event body (inferred by reification)
Throws
if there is no next event or the event type doesn't match