public abstract class EmittingCallbackFn<IN,OUT> extends Emitter implements Callback<IN,OUT>, Fn<IN,OUT>, Emit.IListener<IN>
Modifier and Type | Class and Description |
---|---|
static class |
EmittingCallbackFn.NOP<IN> |
Callback.ProducesMore<IN,OUT,MORE>, Callback.ProducesMultiple<IN,OUT>
Modifier and Type | Field and Description |
---|---|
protected Callback |
nextCallback |
allowDuplicates, idMap, maxListeners
Modifier | Constructor and Description |
---|---|
protected |
EmittingCallbackFn() |
Modifier and Type | Method and Description |
---|---|
abstract OUT |
callback(Exception ex,
IN in,
Object... more)
The callback method
|
protected void |
failFast(Exception ex,
IN in,
Object... more)
failFast means handle any Exception immediately.
|
protected void |
failSlow(Exception ex,
IN in,
Object... more)
failSlow means we let the nextCallback, if any, handle the Exception
|
OUT |
fn1(IN in)
Apply the function to a single argument
|
OUT |
fn2(IN in1,
IN in2ignored)
Apply the function to a two arguments
|
Callback |
getNextCallback()
Get the callback to follow this one.
|
void |
handleEvent(IN arg0,
Object... more)
Receive and handle an "event", represented by arg0 and possibly more.
|
protected void |
handleException(Exception ex,
IN in,
Object... more)
Subclasses may want to override to log, etc...
|
void |
setNextCallback(Callback nextCallback)
Set the callback to follow this one.
|
addListener, createListenerList, emit, emit, fireEvent, getListenerList, listenerCount, listeners, on, once, removeAllListeners, removeListener, setMaxListeners
protected Callback nextCallback
public abstract OUT callback(Exception ex, IN in, Object... more) throws Exception
Callback
public void setNextCallback(Callback nextCallback)
Callback
setNextCallback
in interface Callback<IN,OUT>
nextCallback
- null means end of the linepublic Callback getNextCallback()
Callback
getNextCallback
in interface Callback<IN,OUT>
public OUT fn1(IN in)
Fn
public OUT fn2(IN in1, IN in2ignored)
Fn
public void handleEvent(IN arg0, Object... more)
Emit.IListener
IEmitter.emit()
handleEvent
in interface Emit.IListener<IN>
arg0
- hopefully of type more
- often emptyprotected void failFast(Exception ex, IN in, Object... more) throws Exception
Exception
protected void failSlow(Exception ex, IN in, Object... more) throws Exception
Exception