BasicRelationship Class
- java.
lang. Object - com.
azure. digitaltwins. core. BasicRelationship
- com.
Implements
public final class BasicRelationship
implements JsonSerializable<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 JsonSerializable<T> from azure-json. Because of this, this type will work with any implementation of azure-json but support for generic objects is limited to what JsonWriter supports in JsonWriter#writeUntyped(Object). In order to support custom objects, a custom serializer must be used.
Constructor Summary
| Constructor | Description |
|---|---|
| BasicRelationship(String relationshipId, String sourceDigitalTwinId, String targetDigitalTwinId, String relationshipName) |
Construct a basic digital twin relationship. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Basic |
addProperty(String key, Object value)
Adds a custom property to this model. |
|
static
Basic |
fromJson(JsonReader jsonReader)
Reads an instance of Basic |
| 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 relationship. |
| String |
getName()
Gets the name of the relationship, which defines the type of link (e. |
| Map<String,Object> |
getProperties()
Gets the additional custom properties defined in the model. |
| String |
getSourceId()
Gets the unique ID of the source digital twin. |
| String |
getTargetId()
Gets the unique ID of the target digital twin. |
|
Basic |
setETag(String etag)
Sets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232. |
|
Json |
toJson(JsonWriter jsonWriter) |
Methods inherited from java.lang.Object
Constructor Details
BasicRelationship
public BasicRelationship(String relationshipId, String sourceDigitalTwinId, String targetDigitalTwinId, String relationshipName)
Construct a basic digital twin relationship.
Parameters:
Method Details
addProperty
public BasicRelationship addProperty(String key, Object value)
Adds a 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:
Returns:
fromJson
public static BasicRelationship fromJson(JsonReader jsonReader)
Reads an instance of BasicRelationship from the JsonReader.
Parameters:
Returns:
Throws:
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:
getId
public String getId()
Gets the unique ID of the relationship. This field is present on every relationship.
Returns:
getName
public String getName()
Gets the name of the relationship, which defines the type of link (e.g. Contains). This field is present on every relationship.
Returns:
getProperties
public Map<String,Object> 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:
getSourceId
public String getSourceId()
Gets the unique ID of the source digital twin. This field is present on every relationship.
Returns:
getTargetId
public String getTargetId()
Gets the unique ID of the target digital twin. This field is present on every relationship.
Returns:
setETag
public BasicRelationship setETag(String etag)
Sets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.
Parameters:
Returns: