public class Message
extends java.lang.Object
implements java.io.Serializable
Component
. A message may have a body,
which represents a message's payload to be processed, and multiple attachments.
Both body and attachments are JsonObject
s.
A Component
may retrieve a value from Message
's body by a name,
as shown in the following example.
JsonArray orders = message.getBody().get("orders").getAsJsonArray();
A message is build using Message.Builder
, as shown in the following example.
JsonElement orders = new Gson().toJsonTree(response.getOrders());
JsonObject body = new JsonObject();
body.add("orders", orders);
Message message = new Message.Builder().body(body).build();
Modifier and Type | Class and Description |
---|---|
static class |
Message.Builder
Used to build
Message instances. |
Modifier and Type | Method and Description |
---|---|
com.google.gson.JsonObject |
getAttachments()
Returns message attachments.
|
com.google.gson.JsonObject |
getBody()
Returns message body.
|
java.lang.String |
toString() |
public com.google.gson.JsonObject getBody()
public com.google.gson.JsonObject getAttachments()
public java.lang.String toString()
toString
in class java.lang.Object