DirectMethodPayload Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.device.twin.DirectMethodPayload

public class DirectMethodPayload

This class contains the payload of a direct method request that was received by the device/module. It is used with the onMethodInvoked() callback which is executed each time a direct method is invoked.

Method Summary

Modifier and Type Method and Description
<T> T getPayload(Class<T> clazz)

Return the DirectMethodPayload payload in a custom type of your choosing

JsonElement getPayloadAsJsonElement()

Return the DirectMethodPayload payload in JsonElement type

String getPayloadAsJsonString()

Return the DirectMethodPayload payload in json string Use this if you wish to deserialize to a specific type using a deserialization library of your choice

Method Details

getPayload

public T getPayload(Class clazz)

Return the DirectMethodPayload payload in a custom type of your choosing

Parameters:

clazz - the Custom type into which the payload can be deserialized

Returns:

the DirectMethodPayload payload in Custom type

getPayloadAsJsonElement

public JsonElement getPayloadAsJsonElement()

Return the DirectMethodPayload payload in JsonElement type

Returns:

the DirectMethodPayload payload in JsonElement type

getPayloadAsJsonString

public String getPayloadAsJsonString()

Return the DirectMethodPayload payload in json string Use this if you wish to deserialize to a specific type using a deserialization library of your choice

Returns:

the DirectMethodPayload payload in json string

Applies to