Twin Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. twin. Twin
- com.
public class Twin
Represent the twin on IoT hub. Implementing constructors and serialization functionality.
The object is a representation of a module twin if and only if the moduleId is set.
Constructor Summary
Constructor | Description |
---|---|
Twin() |
Constructor to create an instance for a device. |
Twin(String deviceId) |
Constructor to create instance for a device. |
Twin(String deviceId, String moduleId) |
Constructor to create an instance for a module. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Twin | fromJson(String json) |
Twin |
getDesiredProperties()
Getter to get the desired properties setter. |
Twin |
getReportedProperties()
Getter to get reported properties setter. |
Twin |
getTags()
Getter for the twin tags. |
String |
toString()
String representation for this device containing device Id, tags, desired and reported properties. |
Constructor Details
Twin
public Twin()
Constructor to create an instance for a device.
Twin
public Twin(String deviceId)
Constructor to create instance for a device.
Parameters:
Throws:
This exception is thrown if the device Id isnull
</code> or empty </p>
Twin
public Twin(String deviceId, String moduleId)
Constructor to create an instance for a module.
Parameters:
deviceId
- Id for this device.
moduleId
- Id for this device's module.
Throws:
IllegalArgumentException
- This exception is thrown if the device id isnull
</code> or empty. </p>
Method Details
fromJson
public static Twin fromJson(String json)
Parameters:
json
getDesiredProperties
public TwinCollection getDesiredProperties()
Getter to get the desired properties setter.
Returns:
A set of desired property pairs.
getReportedProperties
public TwinCollection getReportedProperties()
Getter to get reported properties setter.
Returns:
A set of reported property pairs.
getTags
public TwinCollection getTags()
Getter for the twin tags.
Returns:
A set of tag key/value pairs.
toString
public String toString()
String representation for this device containing device Id, tags, desired and reported properties.
Returns:
String representation for this device.
Applies to
Azure SDK for Java