Tools Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.digitaltwin.helpers.Tools

public class Tools

Field Summary

Modifier and Type Field and Description
final Func1<ServiceResponseWithHeaders<Object, DigitalTwinInvokeRootLevelCommandHeaders>, Observable<ServiceResponseWithHeaders<DigitalTwinCommandResponse, DigitalTwinInvokeCommandHeaders>>> FUNC_TO_DIGITAL_TWIN_COMMAND_RESPONSE
final Func1<ServiceResponseWithHeaders<Object, DigitalTwinInvokeComponentCommandHeaders>, Observable<ServiceResponseWithHeaders<DigitalTwinCommandResponse, DigitalTwinInvokeCommandHeaders>>> FUNC_TO_DIGITAL_TWIN_COMPONENT_COMMAND_RESPONSE
final Func1<ServiceResponseWithHeaders<Object, DigitalTwinGetDigitalTwinHeaders>, Observable<ServiceResponseWithHeaders<Object, DigitalTwinGetHeaders>>> FUNC_TO_DIGITAL_TWIN_GET_RESPONSE
final Func1<ServiceResponseWithHeaders<Void, DigitalTwinUpdateDigitalTwinHeaders>, Observable<ServiceResponseWithHeaders<Void, DigitalTwinUpdateHeaders>>> FUNC_TO_DIGITAL_TWIN_UPDATE_RESPONSE

Method Summary

Modifier and Type Method and Description
boolean isNullOrEmpty(String value)

Field Details

FUNC_TO_DIGITAL_TWIN_COMMAND_RESPONSE

public static final Func1, Observable>> FUNC_TO_DIGITAL_TWIN_COMMAND_RESPONSE= object -> { try { DigitalTwinCommandResponse digitalTwinCommandResponse = new DigitalTwinCommandResponse(); digitalTwinCommandResponse.setPayload(new JsonPrimitive(objectMapper.writeValueAsString(object.body()))); digitalTwinCommandResponse.setStatus(object.headers().xMsCommandStatuscode()); DigitalTwinInvokeCommandHeaders digitalTwinInvokeCommandHeaders = new DigitalTwinInvokeCommandHeaders(); digitalTwinInvokeCommandHeaders.setRequestId(object.headers().xMsRequestId()); ServiceResponseWithHeaders result = new ServiceResponseWithHeaders<>(digitalTwinCommandResponse, digitalTwinInvokeCommandHeaders, object.response()); return Observable.just(result); } catch (JsonProcessingException e) { return Observable.error(new IotHubException("Failed to parse the resonse")); } }

FUNC_TO_DIGITAL_TWIN_COMPONENT_COMMAND_RESPONSE

public static final Func1, Observable>> FUNC_TO_DIGITAL_TWIN_COMPONENT_COMMAND_RESPONSE= object -> { try { DigitalTwinCommandResponse digitalTwinCommandResponse = new DigitalTwinCommandResponse(); digitalTwinCommandResponse.setPayload(new JsonPrimitive(objectMapper.writeValueAsString(object.body()))); digitalTwinCommandResponse.setStatus(object.headers().xMsCommandStatuscode()); DigitalTwinInvokeCommandHeaders digitalTwinInvokeCommandHeaders = new DigitalTwinInvokeCommandHeaders(); digitalTwinInvokeCommandHeaders.setRequestId(object.headers().xMsRequestId()); ServiceResponseWithHeaders result = new ServiceResponseWithHeaders<>(digitalTwinCommandResponse, digitalTwinInvokeCommandHeaders, object.response()); return Observable.just(result); } catch (JsonProcessingException e) { return Observable.error(new IotHubException("Failed to parse the resonse")); } }

FUNC_TO_DIGITAL_TWIN_GET_RESPONSE

public static final Func1, Observable>> FUNC_TO_DIGITAL_TWIN_GET_RESPONSE= object -> { DigitalTwinGetHeaders digitalTwinGetHeaders = new DigitalTwinGetHeaders(); digitalTwinGetHeaders.withETag(object.headers().eTag()); ServiceResponseWithHeaders result = new ServiceResponseWithHeaders<>(object.body(), digitalTwinGetHeaders, object.response()); return Observable.just(result); }

FUNC_TO_DIGITAL_TWIN_UPDATE_RESPONSE

public static final Func1, Observable>> FUNC_TO_DIGITAL_TWIN_UPDATE_RESPONSE= object -> { DigitalTwinUpdateHeaders digitalTwinUpdateHeaders = new DigitalTwinUpdateHeaders(); digitalTwinUpdateHeaders.withETag(object.headers().eTag()); digitalTwinUpdateHeaders.withLocation(object.headers().location()); ServiceResponseWithHeaders result = new ServiceResponseWithHeaders<>(object.body(), digitalTwinUpdateHeaders, object.response()); return Observable.just(result); }

Method Details

isNullOrEmpty

public static boolean isNullOrEmpty(String value)

Parameters:

value

Applies to