接口 ServerSentEvent.Builder<T>
- 类型参数:
T- the type of data that this event contains
- 封闭类:
- ServerSentEvent<T>
public static interface ServerSentEvent.Builder<T>
A mutable builder for aSseEvent.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 ServerSentEvent<T>build()Builds the event.ServerSentEvent.Builder<T>comment(String comment)Set SSE comment.ServerSentEvent.Builder<T>data(T data)Set the value of thedatafield.ServerSentEvent.Builder<T>event(String event)Set the value of theeventfield.ServerSentEvent.Builder<T>id(String id)Set the value of theidfield.ServerSentEvent.Builder<T>retry(Duration retry)Set the value of theretryfield.
方法详细资料
id
ServerSentEvent.Builder<T> id(String id)
Set the value of theidfield.- 参数:
id- the value of the id field- 返回:
thisbuilder
event
ServerSentEvent.Builder<T> event(String event)
Set the value of theeventfield.- 参数:
event- the value of the event field- 返回:
thisbuilder
retry
ServerSentEvent.Builder<T> retry(Duration retry)
Set the value of theretryfield.- 参数:
retry- the value of the retry field- 返回:
thisbuilder
comment
ServerSentEvent.Builder<T> comment(String comment)
Set SSE comment. If a multi-line comment is provided, it will be turned into multiple SSE comment lines as defined in Server-Sent Events W3C recommendation.- 参数:
comment- the comment to set- 返回:
thisbuilder
data
ServerSentEvent.Builder<T> data(@Nullable T data)
Set the value of thedatafield. If thedataargument is a multi-lineString, it will be turned into multipledatafield lines as defined in the Server-Sent Events W3C recommendation. Ifdatais not a String, it will be encoded into JSON.- 参数:
data- the value of the data field- 返回:
thisbuilder
build
ServerSentEvent<T> build()
Builds the event.- 返回:
- the built event