Top Description Inners Constructors Methods
org.osgi.util.pushstream

public abstract Class PushEvent<T>

extends Object
Class Inheritance
Known Direct Subclasses
org.osgi.util.pushstream.PushEvent.DataEvent, org.osgi.util.pushstream.PushEvent.ErrorEvent, org.osgi.util.pushstream.PushEvent.CloseEvent
Annotations
@ProviderType
Type Parameters
<T>
The payload type of the event.
Static Imports
org.osgi.util.pushstream.PushEvent.EventType.CLOSE, .PushEvent.EventType.DATA, .PushEvent.EventType.ERROR

A PushEvent is an immutable object that is transferred through a communication channel to push information to a downstream consumer. The event has three different types:

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
public static enum

Constructor Summary

AccessConstructor and Description
pack-priv
PushEvent()

Package private default constructor.

Method Summary

Modifier and TypeMethod and Description
public static <
The payload type.
T
>
PushEvent<T>

Returns:

A new close event.
close
()

Create a new close event.

public static <
The payload type.
T
>
PushEvent<T>

Returns:

A new data event wrapping the specified payload.
data
(T
The payload.
payload
)

Create a new data event.

public static <
The payload type.
T
>
PushEvent<T>

Returns:

A new error event with the specified error.
error
(Throwable
The error.
t
)

Create a new error event.

public T

Returns:

The data payload.
getData
()

Return the data for this event.

public Throwable

Returns:

The error that terminated the stream.
getFailure
()

Return the error that terminated the stream.

public abstract PushEvent.EventType

Returns:

The type of this event.
getType
()

Get the type of this event.

public boolean

Returns:

false if this is a data event, otherwise true.
isTerminal
()

Answer if no more events will follow after this event.

public <
The new payload type.
X
>
PushEvent<X>

Returns:

The current error or close event mapped to a new payload type.
nodata
()

Convenience to cast a close/error event to another payload type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PushEventback to summary
pack-priv PushEvent()

Package private default constructor.

Method Detail

closeback to summary
public static <T> PushEvent<T> close()

Create a new close event.

Parameters
<T>
The payload type.
Returns:PushEvent<T>

A new close event.

databack to summary
public static <T> PushEvent<T> data(T payload)

Create a new data event.

Parameters
<T>
The payload type.
payload:T

The payload.

Returns:PushEvent<T>

A new data event wrapping the specified payload.

errorback to summary
public static <T> PushEvent<T> error(Throwable t)

Create a new error event.

Parameters
<T>
The payload type.
t:Throwable

The error.

Returns:PushEvent<T>

A new error event with the specified error.

getDataback to summary
public T getData()

Return the data for this event.

Returns:T

The data payload.

Exceptions
IllegalStateException:
if this event is not a EventType#DATA event.
getFailureback to summary
public Throwable getFailure()

Return the error that terminated the stream.

Returns:Throwable

The error that terminated the stream.

Exceptions
IllegalStateException:
if this event is not an EventType#ERROR event.
getTypeback to summary
public abstract PushEvent.EventType getType()

Get the type of this event.

Returns:PushEvent.EventType

The type of this event.

isTerminalback to summary
public boolean isTerminal()

Answer if no more events will follow after this event.

Returns:boolean

false if this is a data event, otherwise true.

nodataback to summary
public <X> PushEvent<X> nodata()

Convenience to cast a close/error event to another payload type. Since the payload type is not needed for these events this is harmless. This therefore allows you to forward the close/error event downstream without creating anew event.

Parameters
<X>
The new payload type.
Returns:PushEvent<X>

The current error or close event mapped to a new payload type.

Exceptions
IllegalStateException:
if the event is a EventType#DATA event.
org.osgi.util.pushstream back to summary

pack-priv final Class PushEvent.CloseEvent<T>

extends PushEvent<T>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public PushEvent.EventType
getType()

Implements abstract org.osgi.util.pushstream.PushEvent.getType.

Get the type of this event.

Inherited from org.osgi.util.pushstream.PushEvent:
closedataerrorgetDatagetFailureisTerminalnodata

Constructor Detail

CloseEventback to summary
pack-priv CloseEvent()

Method Detail

getTypeback to summary
public PushEvent.EventType getType()

Implements abstract org.osgi.util.pushstream.PushEvent.getType.

Doc from org.osgi.util.pushstream.PushEvent.getType.

Get the type of this event.

Returns:PushEvent.EventType

The type of this event.

Annotations
@Override
org.osgi.util.pushstream back to summary

pack-priv final Class PushEvent.DataEvent<T>

extends PushEvent<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final T

Constructor Summary

AccessConstructor and Description
pack-priv
DataEvent(T data)

Method Summary

Modifier and TypeMethod and Description
public T
getData()

Overrides org.osgi.util.pushstream.PushEvent.getData.

Return the data for this event.

public PushEvent.EventType
getType()

Implements abstract org.osgi.util.pushstream.PushEvent.getType.

Get the type of this event.

public boolean
isTerminal()

Overrides org.osgi.util.pushstream.PushEvent.isTerminal.

Answer if no more events will follow after this event.

public <X> PushEvent<X>
nodata()

Overrides org.osgi.util.pushstream.PushEvent.nodata.

Convenience to cast a close/error event to another payload type.

Inherited from org.osgi.util.pushstream.PushEvent:
closedataerrorgetFailure

Field Detail

databack to summary
private final T data

Constructor Detail

DataEventback to summary
pack-priv DataEvent(T data)

Method Detail

getDataback to summary
public T getData()

Overrides org.osgi.util.pushstream.PushEvent.getData.

Doc from org.osgi.util.pushstream.PushEvent.getData.

Return the data for this event.

Returns:T

The data payload.

Annotations
@Override
getTypeback to summary
public PushEvent.EventType getType()

Implements abstract org.osgi.util.pushstream.PushEvent.getType.

Doc from org.osgi.util.pushstream.PushEvent.getType.

Get the type of this event.

Returns:PushEvent.EventType

The type of this event.

Annotations
@Override
isTerminalback to summary
public boolean isTerminal()

Overrides org.osgi.util.pushstream.PushEvent.isTerminal.

Doc from org.osgi.util.pushstream.PushEvent.isTerminal.

Answer if no more events will follow after this event.

Returns:boolean

false if this is a data event, otherwise true.

Annotations
@Override
nodataback to summary
public <X> PushEvent<X> nodata()

Overrides org.osgi.util.pushstream.PushEvent.nodata.

Doc from org.osgi.util.pushstream.PushEvent.nodata.

Convenience to cast a close/error event to another payload type. Since the payload type is not needed for these events this is harmless. This therefore allows you to forward the close/error event downstream without creating anew event.

Parameters
<X>
The new payload type.
Returns:PushEvent<X>

The current error or close event mapped to a new payload type.

Annotations
@Override
org.osgi.util.pushstream back to summary

pack-priv final Class PushEvent.ErrorEvent<T>

extends PushEvent<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Throwable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Throwable
getFailure()

Overrides org.osgi.util.pushstream.PushEvent.getFailure.

Return the error that terminated the stream.

public PushEvent.EventType
getType()

Implements abstract org.osgi.util.pushstream.PushEvent.getType.

Get the type of this event.

Inherited from org.osgi.util.pushstream.PushEvent:
closedataerrorgetDataisTerminalnodata

Field Detail

errorback to summary
private final Throwable error

Constructor Detail

ErrorEventback to summary
pack-priv ErrorEvent(Throwable error)

Method Detail

getFailureback to summary
public Throwable getFailure()

Overrides org.osgi.util.pushstream.PushEvent.getFailure.

Doc from org.osgi.util.pushstream.PushEvent.getFailure.

Return the error that terminated the stream.

Returns:Throwable

The error that terminated the stream.

Annotations
@Override
getTypeback to summary
public PushEvent.EventType getType()

Implements abstract org.osgi.util.pushstream.PushEvent.getType.

Doc from org.osgi.util.pushstream.PushEvent.getType.

Get the type of this event.

Returns:PushEvent.EventType

The type of this event.

Annotations
@Override
org.osgi.util.pushstream back to summary

public final Enum PushEvent.EventType

extends Enum<PushEvent.EventType>
Class Inheritance

The type of a PushEvent.

Field Summary

Modifier and TypeField and Description
public static final PushEvent.EventType
CLOSE

An event that indicates that the stream has terminated normally

public static final PushEvent.EventType
DATA

A data event forming part of the stream

public static final PushEvent.EventType
ERROR

An error event that indicates streaming has failed and that no more events will arrive

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PushEvent.EventType
public static PushEvent.EventType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLOSEback to summary
public static final PushEvent.EventType CLOSE

An event that indicates that the stream has terminated normally

DATAback to summary
public static final PushEvent.EventType DATA

A data event forming part of the stream

ERRORback to summary
public static final PushEvent.EventType ERROR

An error event that indicates streaming has failed and that no more events will arrive

Constructor Detail

EventTypeback to summary
private EventType()

Method Detail

valueOfback to summary
public static PushEvent.EventType valueOf(String name)
valuesback to summary
public static PushEvent.EventType[] values()