EventEmittingProjector

class EventEmittingProjector<T : Projection>(delegate: Projector<T>, listener: DiceEventListener = DiceEventListener.DEV_NULL) : Projector<T>

Decorator that emits a ProjectionBatchCompleted event after every projectAll call.

Wraps any Projector via by delegate. Only projectAll is instrumented — it runs the delegate first, then fires exactly one event carrying the success/skip/failure/total counts, and returns the results unchanged. project and all other members forward untouched.

Throw isolation is the listener's responsibility — wrap the listener in SafeDiceEventListener if you need graceful degradation.

Example usage:

val projector = EventEmittingProjector(
delegate = graphProjector,
listener = SafeDiceEventListener(myListener),
)

Parameters

T

The projection type produced by the wrapped Projector.

Constructors

Link copied to clipboard
constructor(delegate: Projector<T>, listener: DiceEventListener = DiceEventListener.DEV_NULL)

Functions

Link copied to clipboard
open override fun project(proposition: Proposition, schema: <Error class: unknown class>): ProjectionResult<T>

Project a single proposition.

Link copied to clipboard
open override fun projectAll(propositions: List<Proposition>, schema: <Error class: unknown class>): ProjectionResults<T>

Delegates to the wrapped projector, then emits one ProjectionBatchCompleted carrying the success/skip/failure/total counts. Returns the results unchanged.