Package com.azure.digitaltwins.core
Class BasicRelationship
java.lang.Object
com.azure.digitaltwins.core.BasicRelationship
Although relationships have a user-defined schema, these properties should exist on every instance.
This is useful to use as a base class to ensure your custom relationships have the necessary properties.
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 BasicRelationship class must
be constructed and have its json properties tagged by the annotation used by that json library.
-
Constructor Summary
ConstructorDescriptionBasicRelationship
(String relationshipId, String sourceDigitalTwinId, String targetDigitalTwinId, String relationshipName) Construct a basic digital twin relationship. -
Method Summary
Modifier and TypeMethodDescriptionaddProperty
(String key, Object value) Adds an additional custom property to this model.getETag()
Gets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.getId()
Gets the unique Id of the relationship.getName()
Gets the name of the relationship, which defines the type of link (e.g.Gets the additional custom properties defined in the model.Gets the unique Id of the source digital twin.Gets the unique Id of the target digital twin.Sets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.
-
Constructor Details
-
BasicRelationship
public BasicRelationship(String relationshipId, String sourceDigitalTwinId, String targetDigitalTwinId, String relationshipName) Construct a basic digital twin relationship.- Parameters:
relationshipId
- The unique Id of this relationship.sourceDigitalTwinId
- The digital twin that this relationship comes from.targetDigitalTwinId
- The digital twin that this relationship points to.relationshipName
- The user defined name of this relationship, for instance "Contains" or "isAdjacentTo"
-
-
Method Details
-
getId
Gets the unique Id of the relationship. This field is present on every relationship.- Returns:
- The unique Id of the relationship. This field is present on every relationship.
-
getSourceId
Gets the unique Id of the source digital twin. This field is present on every relationship.- Returns:
- The unique Id of the source digital twin. This field is present on every relationship.
-
getTargetId
Gets the unique Id of the target digital twin. This field is present on every relationship.- Returns:
- The unique Id of the target digital twin. This field is present on every relationship.
-
getName
Gets the name of the relationship, which defines the type of link (e.g. Contains). This field is present on every relationship.- Returns:
- The name of the relationship, which defines the type of link (e.g. Contains). This field is present on every relationship.
-
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.
-
setETag
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 BasicRelationship object itself.
-
getProperties
Gets the additional custom properties defined in the model. This field will contain any properties of the relationship that are not already defined by the other strong types of this class.- Returns:
- The additional custom properties defined in the model. This field will contain any properties of the relationship that are not already defined by the other strong types of this class.
-
addProperty
Adds an additional custom property to this model. This field will contain any properties of the relationship 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 relationship.value
- The value of the additional property to be added to the relationship.- Returns:
- The BasicRelationship object itself.
-