Class RelationshipParser
- java.lang.Object
-
- com.cognite.client.servicesV1.parser.RelationshipParser
-
public class RelationshipParser extends Object
This class contains a set of methods to help parsing relationship objects between Cognite api representations (json and proto) and typed objects.
-
-
Constructor Summary
Constructors Constructor Description RelationshipParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RelationshipparseRelationship(String json)Parses a relationship json string toRelationshipproto object.static Optional<Relationship.ResourceType>parseResourceType(String type)Tries to parse a string into aResourceType.static Map<String,Object>toRequestInsertItem(Relationship element)Builds a request insert item object fromRelationship.static Map<String,Object>toRequestReplaceItem(Relationship element)Builds a request replace item object fromRelationship.static Map<String,Object>toRequestUpdateItem(Relationship element)Builds a request update item object fromRelationship.static StringtoString(Relationship.ResourceType resourceType)Returns the string representation of a relationship reference resource type.
-
-
-
Method Detail
-
parseRelationship
public static Relationship parseRelationship(String json) throws Exception
Parses a relationship json string toRelationshipproto object.- Parameters:
json-- Returns:
- Throws:
Exception
-
toRequestInsertItem
public static Map<String,Object> toRequestInsertItem(Relationship element)
Builds a request insert item object fromRelationship. An insert item object creates a new asset data object in the Cognite system.- Parameters:
element-- Returns:
-
toRequestUpdateItem
public static Map<String,Object> toRequestUpdateItem(Relationship element)
Builds a request update item object fromRelationship. An update item object updates an existing relationship object with new values for all provided fields. Fields that are not in the update object retain their original value.- Parameters:
element-- Returns:
-
toRequestReplaceItem
public static Map<String,Object> toRequestReplaceItem(Relationship element)
Builds a request replace item object fromRelationship. A replace item object replaces an existing event object with new values for all provided fields. Fields that are not in the update object are set to null.- Parameters:
element-- Returns:
-
toString
public static String toString(Relationship.ResourceType resourceType)
Returns the string representation of a relationship reference resource type.- Parameters:
resourceType-- Returns:
-
parseResourceType
public static Optional<Relationship.ResourceType> parseResourceType(String type)
Tries to parse a string into aResourceType. If the string cannot be parsed, the returnedOptionalwill be empty.- Parameters:
type-- Returns:
-
-