DataType - the type of the data being interceptedpublic interface DataInterceptor<DataType>
AsyncDataLink. That is, before actually notifying the
AsyncDataListener, the appropriate method of this interface is
notified first. It is also possible to filter out some data, so it won't be
forwarded to the listener.
This interface is used by the AsyncDataLink create by the
AsyncLinks.interceptData(AsyncDataLink, DataInterceptor) method.
| Modifier and Type | Method and Description |
|---|---|
boolean |
onDataArrive(DataType newData)
Invoked before data is forwarded to the
AsyncDataListener. |
void |
onDoneReceive(AsyncReport report)
Invoked before the
AsyncDataListener
onDoneReceive was
called. |
boolean onDataArrive(DataType newData)
AsyncDataListener.
It is possible to filter out this data (i.e.: not forward it to the
listener) by returning false.
Since this method is called in a listener, it should be a quick
non-blocking method. Also if this method throws an exception, the data
will not be forwarded (as if returning false). Note however, that
like AsyncDataListener, this method should throw an exception.
newData - the data received and to be forwarded to the
AsyncDataListener. This argument can be null if it is
possible for the providing AsyncDataLink to provide
null data objects.true if the specified data is to be forwarded to the
AsyncDataListener, false if this data should be
filtered out.void onDoneReceive(AsyncReport report)
AsyncDataListener
onDoneReceive was
called.
The onDoneReceive of
the listener will be called after this method returns even if it throws
an exception. Note however, that this method should not throw exceptions,
report - the AsyncReport which is to be passed to the
onDoneReceive
method of the AsyncDataListener. This argument cannot be
null.