public class ReplyPacket extends InteractivePacket
ReplyPacket represents a reply to a request to perform an action.MethodPacket| Constructor and Description |
|---|
ReplyPacket(int id,
com.google.gson.JsonElement result,
InteractiveError error)
Initializes a new
ReplyPacket. |
| Modifier and Type | Method and Description |
|---|---|
InteractiveError |
getError()
Returns the
InteractiveError returned from the Interactive service if there was an error. |
com.google.gson.JsonElement |
getResult()
Returns the result that was returned by the Interactive service for the request.
|
<T> T |
getResultAs(Class<T> clazz)
Returns the result of the request, parsed as an object of type
T. |
<T> T |
getResultAs(Type type)
Returns the result of the request, parsed as an object of type
T. |
boolean |
hasError()
Returns
true if there was an error, false otherwise. |
boolean |
hasResult()
Returns the result that was returned by the Interactive service for the request.
|
getPacketID, getSequenceNumber, getType, setSequenceNumberpublic ReplyPacket(int id,
com.google.gson.JsonElement result,
InteractiveError error)
ReplyPacket.id - Numeric identifier for this packet (should match the method packet identifier that resulted in
this reply)result - Unstructured result of the request returned by the Interactive serviceerror - InteractiveError that may be returned by the Interactive servicepublic boolean hasResult()
true if a result object was returned from the Interactive service,
false otherwisepublic com.google.gson.JsonElement getResult()
public <T> T getResultAs(Type type)
T.T - Class of object to be parsed from the replytype - Type of object to be parsed from replyTpublic <T> T getResultAs(Class<T> clazz)
T.T - Class of object to be parsed from the replyclazz - Class of object to be parsed from the replyTpublic boolean hasError()
true if there was an error, false otherwise.true if there was an error, false otherwisepublic InteractiveError getError()
InteractiveError returned from the Interactive service if there was an error.InteractiveError returned from the Interactive service if there was an errorCopyright © 2018. All rights reserved.