T
- The payload type of the event.@ProviderType public abstract class PushEvent<T> extends Object
PushEvent.EventType.DATA
– Provides access to a typed data element in the
stream.
PushEvent.EventType.CLOSE
– The stream is closed. After receiving this
event, no more events will follow.
PushEvent.EventType.ERROR
– The stream ran into an unrecoverable problem
and is sending the reason downstream. The stream is closed and no more events
will follow after this event.
Modifier and Type | Class and Description |
---|---|
static class |
PushEvent.EventType
The type of a
PushEvent . |
Modifier and Type | Method and Description |
---|---|
static <T> PushEvent<T> |
close()
Create a new close event.
|
static <T> PushEvent<T> |
data(T payload)
Create a new data event.
|
static <T> PushEvent<T> |
error(Throwable t)
Create a new error event.
|
T |
getData()
Return the data for this event.
|
Throwable |
getFailure()
Return the error that terminated the stream.
|
abstract PushEvent.EventType |
getType()
Get the type of this event.
|
boolean |
isTerminal()
Answer if no more events will follow after this event.
|
<X> PushEvent<X> |
nodata()
Convenience to cast a close/error event to another payload type.
|
public abstract PushEvent.EventType getType()
public T getData()
IllegalStateException
- if this event is not a
PushEvent.EventType.DATA
event.public Throwable getFailure()
IllegalStateException
- if this event is not an
PushEvent.EventType.ERROR
event.public boolean isTerminal()
false
if this is a data event, otherwise true
.public static <T> PushEvent<T> data(T payload)
T
- The payload type.payload
- The payload.public static <T> PushEvent<T> error(Throwable t)
T
- The payload type.t
- The error.public static <T> PushEvent<T> close()
T
- The payload type.public <X> PushEvent<X> nodata()
X
- The new payload type.IllegalStateException
- if the event is a PushEvent.EventType.DATA
event.Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0