TwinProperties Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.twin.TwinProperties

public class TwinProperties

Representation of a single Twin Properties for the TwinState.

The Properties on the TwinState shall contains one TwinCollection of desired property.

The desired property is a collection that can contain a associated TwinMetadata.

These metadata are provided by the Service and contains information about the last updated date time, and version.

For instance, the following is a valid desired property, represented as properties.desired 

</code> in the rest API. <pre><code>{

    "desired": {

        "MaxSpeed":{

            "Value":500,

            "NewValue":300

        },

        "$metadata":{

            "$lastUpdated":"2017-09-21T02:07:44.238Z",

            "$lastUpdatedVersion":4,

            "MaxSpeed":{

                "$lastUpdated":"2017-09-21T02:07:44.238Z",

                "$lastUpdatedVersion":4,

                "Value":{

                    "$lastUpdated":"2017-09-21T02:07:44.238Z",

                    "$lastUpdatedVersion":4

                },

                "NewValue":{

                    "$lastUpdated":"2017-09-21T02:07:44.238Z",

                    "$lastUpdatedVersion":4

                }

            }

        },

        "$version":4

    },

    "reported": {

        "MaxSpeed":{

            "Value":500,

            "NewValue":300

        },

        "$metadata":{

            "$lastUpdated":"2017-09-21T02:07:44.238Z",

            "$lastUpdatedVersion":5,

            "MaxSpeed":{

                "$lastUpdated":"2017-09-21T02:07:44.238Z",

                "$lastUpdatedVersion":4,

                "Value":{

                    "$lastUpdated":"2017-09-21T02:07:44.238Z",

                    "$lastUpdatedVersion":5

                },

                "NewValue":{

                    "$lastUpdated":"2017-09-21T02:07:44.238Z",

                    "$lastUpdatedVersion":4

                }

            }

        },

        "$version":6

    }

}

</code></pre></p>

Method Summary

Modifier and Type Method and Description
TwinCollection getDesired()

Getter for the desired property.

TwinCollection getReported()

Getter for the reported property.

String toString()

Creates a pretty print JSON with the content of this class and subclasses.

Method Details

getDesired

public TwinCollection getDesired()

Getter for the desired property.

Returns:

TheTwinCollection 

</code> with the desired property content. It can be<code>null 

</code> . </p>

getReported

public TwinCollection getReported()

Getter for the reported property.

Returns:

TheTwinCollection 

</code> with the reported property content. It can be<code>null 

</code> . </p>

toString

public String toString()

Creates a pretty print JSON with the content of this class and subclasses.

Returns:

TheString 

</code> with the pretty print JSON. </p>

Applies to