TwinMetadata Class

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

public class TwinMetadata

Representation of a single Twin metadata for the TwinCollection.

The metadata is a set of pairs lastUpdated/lastUpdatedVersion for each property and sub-property in the Twin. It is optionally provided by the service and the clients can only ready it.

This class store the Date and Version for each entity in the TwinCollection.

For instance, the following is a valid TwinCollection with its metadata.

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

    "$lastUpdatedVersion":4,

    "MaxSpeed":{

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

        "$lastUpdatedVersion":3,

        "$lastUpdatedBy": "newconfig",

        "$lastUpdatedByDigest": "637570574076206429",

        "Value":{

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

            "$lastUpdatedVersion":5

        },

        "NewValue":{

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

            "$lastUpdatedVersion":5

        }

    }

}

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

Field Summary

Modifier and Type Field and Description
final String LAST_UPDATE_TAG
final String LAST_UPDATE_VERSION_TAG
final String LAST_UPDATED_BY
final String LAST_UPDATED_BY_DIGEST

Method Summary

Modifier and Type Method and Description
Date getLastUpdated()

Getter for lastUpdated.

String getLastUpdatedBy()

Getter for lastUpdatedBy.

String getLastUpdatedByDigest()

Getter for lastUpdatedByDigest.

Integer getLastUpdatedVersion()

Getter for lastUpdatedVersion.

String toString()

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

Field Details

LAST_UPDATE_TAG

public static final String LAST_UPDATE_TAG= "$lastUpdated"

LAST_UPDATE_VERSION_TAG

public static final String LAST_UPDATE_VERSION_TAG= "$lastUpdatedVersion"

LAST_UPDATED_BY

public static final String LAST_UPDATED_BY= "$lastUpdatedBy"

LAST_UPDATED_BY_DIGEST

public static final String LAST_UPDATED_BY_DIGEST= "$lastUpdatedByDigest"

Method Details

getLastUpdated

public Date getLastUpdated()

Getter for lastUpdated.

Returns:

theDate 

</code> with the stored lastUpdated. It can be<code>null 

</code> . </p>

getLastUpdatedBy

public String getLastUpdatedBy()

Getter for lastUpdatedBy.

Returns:

theString 

</code> representing the configuration LastUpdatedBy. </p>

getLastUpdatedByDigest

public String getLastUpdatedByDigest()

Getter for lastUpdatedByDigest.

Returns:

theString 

</code> with the stored lastUpdatedByDigest. </p>

getLastUpdatedVersion

public Integer getLastUpdatedVersion()

Getter for lastUpdatedVersion.

Returns:

theInteger 

</code> with the stored lastUpdatedVersion. 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