BasicDigitalTwin Class

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

public final class BasicDigitalTwin

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

Note that this class uses JsonProperty from the Jackson serialization library. Because of this, this type will only work if the default json serializer is used by the digital twins client or if the custom json serializer uses Jackson as well. In order to use a different json library, a new BasicDigitalTwin class must be constructed and have its json properties tagged by the annotation used by that json library.

Constructor Summary

Constructor Description
BasicDigitalTwin(String digitalTwinId)

Construct a basic digital twin.

Method Summary

Modifier and Type Method and Description
BasicDigitalTwin addToContents(String key, Object value)

Adds an additional custom property to the digital twin contents.

Map<String,Object> getContents()

Gets the additional custom contents of the digital twin.

String getETag()

Gets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.

String getId()

Gets the unique Id of the digital twin in a digital twins instance.

OffsetDateTime getLastUpdatedOn()

Gets the date and time when the twin was last updated.

BasicDigitalTwinMetadata getMetadata()

Gets the information about the model a digital twin conforms to.

BasicDigitalTwin setETag(String etag)

Sets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.

BasicDigitalTwin setMetadata(BasicDigitalTwinMetadata metadata)

Sets the information about the model a digital twin conforms to.

Methods inherited from java.lang.Object

Constructor Details

BasicDigitalTwin

public BasicDigitalTwin(String digitalTwinId)

Construct a basic digital twin.

Parameters:

digitalTwinId - The Id of the digital twin. The Id is unique within the service and case sensitive.

Method Details

addToContents

public BasicDigitalTwin addToContents(String key, Object value)

Adds an additional custom property to the digital twin contents. This field will contain any contents of the digital twin that are 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.

getContents

public Map getContents()

Gets the additional custom contents of the digital twin. This field will contain any contents of the digital twin that are not already defined by the other strong types of this class.

Returns:

The additional contents of the digital twin. This field will contain any contents of the digital twin that are not already defined by the other strong types of this class.

getETag

public String getETag()

Gets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.

Returns:

A string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.

getId

public String getId()

Gets the unique Id of the digital twin in a digital twins instance. This field is present on every digital twin.

Returns:

The unique Id of the digital twin in a digital twins instance. This field is present on every digital twin.

getLastUpdatedOn

public OffsetDateTime getLastUpdatedOn()

Gets the date and time when the twin was last updated.

Returns:

The date and time the twin was last updated.

getMetadata

public BasicDigitalTwinMetadata getMetadata()

Gets the information about the model a digital twin conforms to. This field is present on every digital twin.

Returns:

The information about the model a digital twin conforms to. This field is present on every digital twin.

setETag

public BasicDigitalTwin setETag(String etag)

Sets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.

Parameters:

etag - A string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.

Returns:

The BasicDigitalTwin object itself.

setMetadata

public BasicDigitalTwin setMetadata(BasicDigitalTwinMetadata metadata)

Sets the information about the model a digital twin conforms to. This field is present on every digital twin.

Parameters:

metadata - The information about the model a digital twin conforms to. This field is present on every digital twin.

Returns:

The BasicDigitalTwin object itself.

Applies to