Share via


BasicDigitalTwinMetadata Class

  • java.lang.Object
    • com.azure.digitaltwins.core.BasicDigitalTwinMetadata

Implements

public final class BasicDigitalTwinMetadata
implements JsonSerializable<BasicDigitalTwinMetadata>

An optional, helper class for deserializing a digital twin. The $metadata class on a BasicDigitalTwin. Only properties with non-null values are included.

Constructor Summary

Constructor Description
BasicDigitalTwinMetadata()

Creates an instance of digital twin metadata.

Method Summary

Modifier and Type Method and Description
BasicDigitalTwinMetadata addPropertyMetadata(String key, DigitalTwinPropertyMetadata value)

Adds a custom property to the digital twin.

static BasicDigitalTwinMetadata fromJson(JsonReader jsonReader)

Reads an instance of BasicDigitalTwinMetadata from the JsonReader.

String getModelId()

Gets the ID of the model that the digital twin or component is modeled by.

Map<String,DigitalTwinPropertyMetadata> getPropertyMetadata()

Gets the metadata about changes on properties on a component.

BasicDigitalTwinMetadata setModelId(String modelId)

Sets the ID of the model that the digital twin or component is modeled by.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

BasicDigitalTwinMetadata

public BasicDigitalTwinMetadata()

Creates an instance of digital twin metadata.

Method Details

addPropertyMetadata

public BasicDigitalTwinMetadata addPropertyMetadata(String key, DigitalTwinPropertyMetadata value)

Adds a custom property to the digital twin. This field will contain any property of the digital twin that is not already defined by the other strong types of this class.

Parameters:

key - The key of the additional property to be added to the digital twin.
value - The value of the additional property to be added to the digital twin.

Returns:

The BasicDigitalTwin object itself.

fromJson

public static BasicDigitalTwinMetadata fromJson(JsonReader jsonReader)

Reads an instance of BasicDigitalTwinMetadata from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of BasicDigitalTwinMetadata if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the BasicDigitalTwinMetadata.

getModelId

public String getModelId()

Gets the ID of the model that the digital twin or component is modeled by.

Returns:

The ID of the model that the digital twin or component is modeled by.

getPropertyMetadata

public Map<String,DigitalTwinPropertyMetadata> getPropertyMetadata()

Gets the metadata about changes on properties on a component. The values can be deserialized into DigitalTwinPropertyMetadata

Returns:

The metadata about changes on properties on a component.

setModelId

public BasicDigitalTwinMetadata setModelId(String modelId)

Sets the ID of the model that the digital twin or component is modeled by.

Parameters:

modelId - The ID of the model that the digital twin or component is modeled by.

Returns:

The BasicDigitalTwinMetadata object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to