T
- the type of data itempublic interface StreamEvent<T>
Modifier and Type | Method and Description |
---|---|
Throwable |
getError()
The error, if this event represents an error.
|
T |
getItem()
The data, if this event represents an emission of data.
|
long |
getRequestAmount()
The request amount, if this event represents a request.
|
int |
getSubscriptionId()
The opaque id of the subscription that this event relates to.
|
boolean |
isCancel()
Whether or not this event represents cancellation of the stream.
|
boolean |
isComplete()
Whether or not this event represents the completion of the stream.
|
boolean |
isData()
Whether or not this event represents an emission of data.
|
boolean |
isError()
Whether or not this event represents an error.
|
boolean |
isRequest()
Whether or not this event represents a request for more data.
|
int getSubscriptionId()
Events are emitted for each subscription to a publisher. This value can be used for differentiating events from different subscriptions.
The ids are only unique for a context. That is, they are not globally unique. More precise semantics of ids should be specified by methods that emit events.
boolean isComplete()
boolean isError()
If this method returns true
, getError()
will return the corresponding exception.
If this method returns false
, getError()
will return null
.
boolean isData()
If this method returns true
, getItem()
will return the corresponding data.
If this method returns false
, getItem()
will return null
.
boolean isCancel()
boolean isRequest()
If this method returns true
, getRequestAmount()
will return the amount requested.
If this method returns false
, getRequestAmount()
will return 0
.
long getRequestAmount()
If isRequest()
returns true
, this method will return the corresponding request amount.
If isRequest()
returns false
, this method will return 0
.
0
@Nullable Throwable getError()
If isError()
returns true
, this method will return the corresponding exception.
If isError()
returns false
, this method will return null.
null