DeserializationHelpers Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.digitaltwin.serialization.DeserializationHelpers

public class DeserializationHelpers

Method Summary

Modifier and Type Method and Description
static<T> T castObject(ObjectMapper mapper, Object payload, Class<T> clazz)

Converts the payload object into a generic type. There are two different paths we will have to take based on the type T In case of a String, we need to write the value of the payload as a String In case of any other type that the user decides to deserialize the payload, we will use mapper.convertValue to perform the conversion. Updates a digital twin.

Method Details

castObject

public static static T castObject(ObjectMapper mapper, Object payload, Class clazz)

Converts the payload object into a generic type. There are two different paths we will have to take based on the type T In case of a String, we need to write the value of the payload as a String In case of any other type that the user decides to deserialize the payload, we will use mapper.convertValue to perform the conversion. Updates a digital twin.

Parameters:

mapper - Object Mapper
payload - payload object to cast.
clazz - The class to deserialize the object into.

Returns:

T The generic type response.

Throws:

JsonProcessingException - Json parsing exception.

Applies to