### YamlMime:JavaType constructors: - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.Twin(TwinCollection desiredProperty, TwinCollection reportedProperty) name: Twin(TwinCollection desiredProperty, TwinCollection reportedProperty) nameWithType: Twin.Twin(TwinCollection desiredProperty, TwinCollection reportedProperty) parameters: - description: >-
the null
.
the null
.
CONSTRUCTOR
\r\nThis constructor creates an instance of the Twin with the provided
When serialized, this class will looks like the following example:
\"initialTwin\": {\r\n \"tags\":{\r\n \"SpeedUnity\":\"MPH\",\r\n \"$version\":4\r\n }\r\n \"properties\":{\r\n \"desired\":{\r\n \"MaxSpeed\":{\r\n \"Value\":500,\r\n \"NewValue\":300\r\n },\r\n \"$version\":4\r\n }\r\n }\r\n }\r\n
\r\n }\r\n
\r\n"
syntax: public Twin(TwinCollection desiredProperty, TwinCollection reportedProperty)
uid: com.microsoft.azure.sdk.iot.device.twin.Twin.Twin(TwinCollection,TwinCollection)
inheritances:
- theString
with the JSON received from the service. It cannot benull
or empty.
The new instance of theTwin
.
Factory
Create a new instance of the Twin parsing the provided string as a JSON with only desired properties information.
syntax: public static Twin createFromDesiredPropertyJson(String json) uid: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromDesiredPropertyJson(String) - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromPropertiesJson(String json) name: createFromPropertiesJson(String json) nameWithType: Twin.createFromPropertiesJson(String json) parameters: - description: >-theString
with the JSON received from the service. It cannot benull
or empty.
The new instance of theTwin
.
Factory
Create a new instance of the Twin parsing the provided string as a JSON with only desired properties information.
syntax: public static Twin createFromPropertiesJson(String json) uid: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromPropertiesJson(String) - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromReportedPropertyJson(String json) name: createFromReportedPropertyJson(String json) nameWithType: Twin.createFromReportedPropertyJson(String json) parameters: - description: >-theString
with the JSON received from the service. It cannot benull
or empty.
The new instance of theTwin
.
Factory
Create a new instance of the Twin parsing the provided string as a JSON with only reported properties information.
syntax: public static Twin createFromReportedPropertyJson(String json) uid: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromReportedPropertyJson(String) - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromTwinJson(String json) name: createFromTwinJson(String json) nameWithType: Twin.createFromTwinJson(String json) parameters: - description: >-theString
with the JSON received from the service. It cannot benull
or empty.
The new instance of theTwin
.
Factory
Create a new instance of the Twin parsing the provided string as a JSON with the full Twin information.
syntax: public static Twin createFromTwinJson(String json) uid: com.microsoft.azure.sdk.iot.device.twin.Twin.createFromTwinJson(String) - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.getDesiredProperties() name: getDesiredProperties() nameWithType: Twin.getDesiredProperties() returns: description: >-TheTwinCollection
with the desired property content. It can benull
.
Getter for the desired property.
syntax: public TwinCollection getDesiredProperties() uid: com.microsoft.azure.sdk.iot.device.twin.Twin.getDesiredProperties() - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.getReportedProperties() name: getReportedProperties() nameWithType: Twin.getReportedProperties() returns: description: >-TheTwinCollection
with the reported property content. It can benull
.
Getter for the reported property.
syntax: public TwinCollection getReportedProperties() uid: com.microsoft.azure.sdk.iot.device.twin.Twin.getReportedProperties() - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.toJsonElement() name: toJsonElement() nameWithType: Twin.toJsonElement() returns: description: >-TheJsonElement
with the content of this class.
Serializer
Creates aJsonElement
, 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.
syntax: public JsonElement toJsonElement() uid: com.microsoft.azure.sdk.iot.device.twin.Twin.toJsonElement() - fullName: com.microsoft.azure.sdk.iot.device.twin.Twin.toString() name: toString() nameWithType: Twin.toString() returns: description: >-TheString
with the pretty print JSON.
Creates a pretty print JSON with the content of this class and subclasses.
syntax: public String toString() uid: com.microsoft.azure.sdk.iot.device.twin.Twin.toString() nameWithType: Twin syntax: public class Twin type: class uid: com.microsoft.azure.sdk.iot.device.twin.Twin fullName: com.microsoft.azure.sdk.iot.device.twin.Twin name: Twin package: com.microsoft.azure.sdk.iot.device.twin summary: >-Representation of a single Twin.
The Twin can contain one
Each entity in the collections can contain a associated
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 Twin, represented as initialTwin
in the rest API.
{
"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
}
}
}
}
metadata: {}