TwinState 类
定义
Representation of a single Twin.
The TwinState can contain one TwinCollection of Tags, and one TwinCollection of properties.desired.
Each entity in the collections 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 TwinState, represented as
initialTwin
</code> in the rest API. <pre><code>{
"initialTwin": {
"tags":{
"SpeedUnity":"MPH",
"$metadata":{
"$lastUpdated":"2017-09-21T02:07:44.238Z",
"$lastUpdatedVersion":4,
"SpeedUnity":{
"$lastUpdated":"2017-09-21T02:07:44.238Z",
"$lastUpdatedVersion":4
}
},
"$version":4
},
"properties":{
"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>
public class TwinState extends RegisterManager
- 继承
继承成员
构造函数
TwinState(TwinCollection tags, TwinCollection desiredProperty, TwinCollection reportedProperty) |
CONSTRUCTOR This constructor creates an instance of the TwinState with the provided TwinCollection tags and desired properties. When serialized, this class will looks like the following example:
|
方法
createFromDesiredPropertyJson(String json) |
Factory Create a new instance of the TwinState parsing the provided string as a JSON with only desired properties information.
|
createFromPropertiesJson(String json) |
Factory Create a new instance of the TwinState parsing the provided string as a JSON with only desired properties information.
|
createFromReportedPropertyJson(String json) |
Factory Create a new instance of the TwinState parsing the provided string as a JSON with only reported properties information.
|
createFromTwinJson(String json) |
Factory Create a new instance of the TwinState parsing the provided string as a JSON with the full Twin information.
|
getConfigurations() |
Getter for the configurations
|
getConnectionState() |
Get the connection state |
getDesiredProperty() |
Getter for the desired property.
|
getDeviceScope() |
Gets the device scope.
|
getParentScopes() |
Gets the parent scopes.
|
getReportedProperty() |
Getter for the reported property.
|
getTags() |
Getter for the tags.
|
toJsonElement() |
Serializer Creates a This is useful if the caller will integrate this JSON with JSON from other classes to generate a consolidated JSON.
|
toString() |
Creates a pretty print JSON with the content of this class and subclasses.
|