TwinParser 类

定义

TwinParser Representation including the twin collection and Json serializer and deserializer. Deprecated

As of release 0.4.0, replaced by TwinState

public class TwinParser
继承
java.lang.Object
TwinParser

构造函数

TwinParser()

CONSTRUCTOR Create a TwinParser instance with default values. set OnDesiredCallback as null set OnReportedCallback as null set Tags as null

TwinParser(TwinChangedCallback onDesiredCallback)

CONSTRUCTOR Create a TwinParser instance with default values. set OnReportedCallback as null set Tags as null

TwinParser(TwinChangedCallback onDesiredCallback, TwinChangedCallback onReportedCallback)

CONSTRUCTOR Create a TwinParser instance with default values. set Tags as null

字段

manager
properties
tags

方法

enableMetadata()

Enable metadata report in the Json.

enableTags()

Enable tags in the Twin collection and in the Json.

getConnectionState()

Getter for connection state

getConnectionStateUpdatedTime()

Getter for connection state updated date and time

getDesiredPropertyMap()

Return a map with all `desired` properties in the collection.

getDesiredPropertyVersion()

Return the `desired` property version.

getDeviceId()

Getter for device name

getETag()

Getter for ETag

getGenerationId()

Getter for device generation name

getLastActivityTime()

Getter for last activity time

getReportedPropertyMap()

Return a map with all `reported` properties in the collection.

getReportedPropertyVersion()

Return the `reported` property version.

getStatus()

Getter for device status

getStatusReason()

Getter for status reason

getStatusUpdatedTime()

Getter for status updated date and time

getTagsMap()

Return a map with all `tags` in the collection.

getVersion()

Getter for Twin version

resetDesiredProperty(Map<String, Object> propertyMap)

Reset the `desired` properties information in the collection, deleting all old properties and add all the new provided ones. Return a string with a json that contains a sub-collection of added properties.

resetReportedProperty(Map<String, Object> propertyMap)

Reset the `reported` properties information in the collection, deleting all old properties and add all the new provided ones. Return a string with a json that contains a sub-collection of added properties.

resetTags(Map<String, Object> tagsMap)

Reset the `tags` information in the collection, deleting all old tags and add all the new provided ones. Return a string with a json that contains a sub-collection of added tags.

setDesiredCallback(TwinChangedCallback onDesiredCallback)

Set the callback function to report changes on the `Desired` collection when `TwinParser` receives a new json.

setDeviceId(String deviceId)

Setter for device name

setETag(String eTag)

Setter for ETag.

setReportedCallback(TwinChangedCallback onReportedCallback)

Set the callback function to report changes on the `Reported` collection when `TwinParser` receives a new json.

setTagsCallback(TwinChangedCallback onTagsCallback)

Set the callback function to report changes on the `tags` collection when `TwinParser` receives a new json.

toJson()

Create a String with a json content that represents all the information in the TwinParser class and innerClasses.

toJsonElement()

Create a JsonElement that represents all the information in the TwinParser class and innerClasses.

updateDesiredProperty(Map<String, Object> propertyMap)

Update the `desired` properties information in the collection, and return a string with a json that contains a sub-collection of added properties, or properties with new value.

updateDesiredProperty(String json)

Update the `desired` properties information in the collection, using the information parsed from the provided json. It will fire a callback if any property was added, excluded, or had its value updated.

updateDeviceManager(String deviceId, TwinStatus status, String statusReason)

Update the device manager information in the collection, and return a string with a json that contains a the new device manager description, including new and old values.

updateReportedProperty(Map<String, Object> propertyMap)

Update the `reported` properties information in the collection, and return a string with a json that contains a sub-collection of added properties, or properties with new value.

updateReportedProperty(String json)

Update the `reported` properties information in the collection, using the information parsed from the provided json. It will fire a callback if any property was added, excluded, or had its value updated.

updateTags(Map<String, Object> tagsMap)

Update the `tags` information in the collection, and return a string with a json that contains a sub-collection of added tags, or tags with new value.

updateTwin(Map<String, Object> desiredPropertyMap, Map<String, Object> reportedPropertyMap, Map<String, Object> tagsMap)

Update properties and tags information in the collection, and return a string with a json that contains a sub-collection of added properties, properties with new value, added tags, and tags with new values.

updateTwin(String json)

Update the properties information in the collection, using the information parsed from the provided json. It will fire a callback if any property was added, excluded, or had its value updated.

适用于