Handler

object Handler
Companion:
class
class Object
trait Matchable
class Any
Handler.type

Value members

Concrete methods

def bindDownstream[In, Out](inner: Handler[In, Out], downstream: BoundHandler[Out]): BoundHandler[In]

Combine a handler with a predetermined "downstream", creating a BoundHandler whose push and finish methods delegate to that downstream receiver instead of needing to accept one as a parameter.

Combine a handler with a predetermined "downstream", creating a BoundHandler whose push and finish methods delegate to that downstream receiver instead of needing to accept one as a parameter.

This is useful for implementing more complex handlers, or when interfacing with a Transformer without a Parser, e.g. in order to collect outputs from a transformer into a buffer.

Type parameters:
In

The input event type

Out

The output event type

Value parameters:
downstream

The "downstream" handler which will receive outputs from inner

inner

The "upstream" handler

Returns:

A sink for In events which uses the inner handler to receive events, and the downstream handler to receive outputs from inner

def bindVariableDownstream[In, Out](inner: Handler[In, Out]): BoundHandler[In] & HandlerLinkage[Out]

Combine an existing handler with a variable "downstream" handler, creating a BoundHandler whose push and finish methods delegate to whatever the current "downstream" is, instead of needing to accept the downstream as a parameter.

Combine an existing handler with a variable "downstream" handler, creating a BoundHandler whose push and finish methods delegate to whatever the current "downstream" is, instead of needing to accept the downstream as a parameter.

This is similar to bindDownstream except that you can swap out the actual downstream handler at any time. This primarily exists as a helper for wiring chains of transformers together; you probably don't want to use this directly.

def protect[In, Out](inner: Handler[In, Out]): Handler[In, Out]

Wrap an existing transformer handler, protecting it from misuse of the Handler interface methods. The returned handler guarantees that once the inner handler returns a Stop signal, throws an exception, or is told to finish(), the returned handler will no-op for subsequent calls to finish or push.

Wrap an existing transformer handler, protecting it from misuse of the Handler interface methods. The returned handler guarantees that once the inner handler returns a Stop signal, throws an exception, or is told to finish(), the returned handler will no-op for subsequent calls to finish or push.

Furthermore, exceptions thrown by the inner handler will be passed to the inner handler's bubbleUp method, allowing for possible transformation of errors thrown by the inner handler as if that inner handler had try/catch wrappers around all of its own logic.

Type parameters:
In

The input event type

Out

The output event type

Value parameters:
inner

The handler to wrap

Returns:

A new handler which wraps the inner one, protecting it against interface misuse.