接口 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 thedata
field.ServerSentEvent.Builder<T>
event(String event)
Set the value of theevent
field.ServerSentEvent.Builder<T>
id(String id)
Set the value of theid
field.ServerSentEvent.Builder<T>
retry(Duration retry)
Set the value of theretry
field.
方法详细资料
id
ServerSentEvent.Builder<T> id(String id)
Set the value of theid
field.- 参数:
id
- the value of the id field- 返回:
this
builder
event
ServerSentEvent.Builder<T> event(String event)
Set the value of theevent
field.- 参数:
event
- the value of the event field- 返回:
this
builder
retry
ServerSentEvent.Builder<T> retry(Duration retry)
Set the value of theretry
field.- 参数:
retry
- the value of the retry field- 返回:
this
builder
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- 返回:
this
builder
data
ServerSentEvent.Builder<T> data(@Nullable T data)
Set the value of thedata
field. If thedata
argument is a multi-lineString
, it will be turned into multipledata
field lines as defined in the Server-Sent Events W3C recommendation. Ifdata
is not a String, it will be encoded into JSON.- 参数:
data
- the value of the data field- 返回:
this
builder
build
ServerSentEvent<T> build()
Builds the event.- 返回:
- the built event