public class TwinProperties extends Object
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 in the rest API.
{
"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
}
}
| Modifier and Type | Method and Description |
|---|---|
TwinCollection |
getDesired()
Getter for the desired property.
|
TwinCollection |
getReported()
Getter for the reported property.
|
protected com.google.gson.JsonElement |
toJsonElement()
Serializer
|
protected com.google.gson.JsonElement |
toJsonElementWithMetadata()
Serializer
|
String |
toString()
Creates a pretty print JSON with the content of this class and subclasses.
|
protected com.google.gson.JsonElement toJsonElement()
Creates a JsonElement, which the content represents
the information in this class and its subclasses in a JSON format.
This is useful if the caller will integrate this JSON with JSON from
other classes to generate a consolidated JSON.
JsonElement with the content of this class.protected com.google.gson.JsonElement toJsonElementWithMetadata()
Creates a JsonElement, which the content represents
the information in this class and its subclasses in a JSON format.
If the desired property contains metadata, this method will include
it in the final JSON.
This is useful if the caller will integrate this JSON with JSON from
other classes to generate a consolidated JSON.
JsonElement with the content of this class.public TwinCollection getDesired()
TwinCollection with the desired property content. It can be null.public TwinCollection getReported()
TwinCollection with the reported property content. It can be null.Copyright © 2019. All rights reserved.