Interface Event<T>
-
- Type Parameters:
T- the item type contained in the event
- All Superinterfaces:
ServerSentEvent
@Deprecated public interface Event<T> extends ServerSentEvent
Deprecated.since 1.10 - useServerSentEventAn individual event in a server sent event stream.The
itemis the item in the data stream being emitted as a server sent event. It can be used to derive values for theid(ratpack.func.Function<? super T, java.lang.String>),event(ratpack.func.Function<? super T, java.lang.String>)and/ordata(ratpack.func.Function<? super T, java.lang.String>)fields.By default, the
id,eventanddatafields are set tonull.- See Also:
ServerSentEvents
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Event<T>comment(java.lang.String comment)Deprecated.Specify a comment to include as part of this event.Event<T>data(java.lang.String data)Deprecated.Specify the event data for the server sent event.Event<T>data(Function<? super T,java.lang.String> function)Deprecated.Sets the “data” value of the event to the return value of the given function.Event<T>event(java.lang.String event)Deprecated.Specify the event type for the server sent event.Event<T>event(Function<? super T,java.lang.String> function)Deprecated.Sets the “event” value of the event to the return value of the given function.java.lang.StringgetComment()Deprecated.The comment for this event.java.lang.StringgetData()Deprecated.The “data” value of the event.java.lang.StringgetEvent()Deprecated.The “event” value of the event.java.lang.StringgetId()Deprecated.The “id” value of the event.TgetItem()Deprecated.The stream item that this event.Event<T>id(java.lang.String id)Deprecated.Specify the event id for the server sent event.Event<T>id(Function<? super T,java.lang.String> function)Deprecated.Sets the “id” value of the event to the return value of the given function.
-
-
-
Method Detail
-
getItem
T getItem()
Deprecated.The stream item that this event.- Returns:
- a supporting object
-
getId
java.lang.String getId()
Deprecated.The “id” value of the event.nullby default.- Specified by:
getIdin interfaceServerSentEvent- Returns:
- the “id” value of the event
-
getEvent
java.lang.String getEvent()
Deprecated.The “event” value of the event.nullby default.- Specified by:
getEventin interfaceServerSentEvent- Returns:
- the “event” value of the event
-
getData
java.lang.String getData()
Deprecated.The “data” value of the event.nullby default.- Specified by:
getDatain interfaceServerSentEvent- Returns:
- the “data” value of the event
-
getComment
java.lang.String getComment()
Deprecated.The comment for this event.nullby default.- Specified by:
getCommentin interfaceServerSentEvent- Returns:
- he comment for this event
- Since:
- 1.5
-
id
Event<T> id(Function<? super T,java.lang.String> function) throws java.lang.Exception
Deprecated.Sets the “id” value of the event to the return value of the given function.The function receives the
itemand is executed immediately.The returned value must not contain a
'\n'character as this is not valid in an event value.- Parameters:
function- a generator for the “id” value of the event- Returns:
- this
- Throws:
java.lang.Exception- any thrown byfunction
-
id
Event<T> id(java.lang.String id)
Deprecated.Specify the event id for the server sent event.The value must not contain a
'\n'character as this is not valid in an event value.- Parameters:
id- the event id- Returns:
- this
-
event
Event<T> event(Function<? super T,java.lang.String> function) throws java.lang.Exception
Deprecated.Sets the “event” value of the event to the return value of the given function.The function receives the
itemand is executed immediately.The returned value must not contain a
'\n'character as this is not valid in an event value.- Parameters:
function- a generator for the “event” value of the event- Returns:
- this
- Throws:
java.lang.Exception- any thrown byfunction
-
event
Event<T> event(java.lang.String event)
Deprecated.Specify the event type for the server sent event.The value must not contain a
'\n'character as this is not valid in an event value.- Parameters:
event- the event type- Returns:
- this
-
data
Event<T> data(Function<? super T,java.lang.String> function) throws java.lang.Exception
Deprecated.Sets the “data” value of the event to the return value of the given function.The function receives the
itemand is executed immediately.- Parameters:
function- a generator for the “data” value of the event- Returns:
- this
- Throws:
java.lang.Exception- any thrown byfunction
-
data
Event<T> data(java.lang.String data)
Deprecated.Specify the event data for the server sent event.- Parameters:
data- the event data- Returns:
- this
-
-