public abstract static class Message.MessageBuilder<T extends Message.MessageBuilder<T>>
extends java.lang.Object
Constructor and Description |
---|
MessageBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract Message |
build()
Abstract build method
|
T |
clientId(java.lang.String id)
Sets message client ID.
|
T |
destination(java.lang.String destination)
Set message destination.
|
T |
diagnostic(java.lang.String name,
java.lang.Object value)
Set a diagnostic
Object value |
T |
direction(Message.Direction direction)
Set message direction.
|
T |
eventTime(long eventTime)
Set message creation time.
|
T |
eventTime(java.lang.Long eventTime)
Set message creation time.
|
T |
fromJson(org.json.JSONObject jsonObject)
Method to deserialization of the Message from a JsonObject.
|
T |
id(java.lang.String id)
Sets message ID.
|
T |
priority(Message.Priority priority)
Set message priority.
|
T |
properties(MessageProperties properties)
Set message properties.
|
T |
receivedTime(java.lang.Long time)
Set the time when the message was received by the server.
|
T |
reliability(Message.Reliability reliability)
Sets reliability for message delivering.
|
protected abstract T |
self()
Return current instance of the
Message.MessageBuilder . |
T |
sender(java.lang.String sender)
Set message sender.
|
T |
sentTime(java.lang.Long time)
Set the time when the message was sent by the server.
|
T |
source(java.lang.String source)
Set message source.
|
protected abstract T self()
Message.MessageBuilder
.Message.MessageBuilder
.public final T id(java.lang.String id)
UUID
. If no id is provided during creation of the
Message
, random one is created.id
- UUID
of the message assigned to this message.public final T clientId(java.lang.String id)
Message
, random one is created.id
- UUID
of the message assigned to this message.public final T source(java.lang.String source)
source
- source (source endpoint ID) of the messagepublic final T destination(java.lang.String destination)
destination
- destination (destination endpoint ID) of the messagepublic final T priority(Message.Priority priority)
priority
- priority of the messagepublic final T reliability(Message.Reliability reliability)
reliability
- reliability for message delivering.public final T eventTime(java.lang.Long eventTime)
eventTime
- event time of the messagepublic final T eventTime(long eventTime)
eventTime
- event time of the messagepublic final T properties(MessageProperties properties)
properties
- extra information for the messagepublic final T sender(java.lang.String sender)
sender
- sender (sender endpoint ID) of the messagepublic final T direction(Message.Direction direction)
direction
- message directionpublic final T receivedTime(java.lang.Long time)
time
- epoch value in nano secondspublic final T sentTime(java.lang.Long time)
time
- epoch value in nano secondspublic final T diagnostic(java.lang.String name, java.lang.Object value)
Object
valuename
- diagnostic namevalue
- diagnostic valuepublic T fromJson(org.json.JSONObject jsonObject)
jsonObject
- the jsonObject to fromStringMessageParsingException
- when json object is wrong or
does not contain mandatory fields.public abstract Message build()