com.microsoft.azure.sdk.iot.service.digitaltwin.UpdateOperationUtility Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iot-service-client Show documentation
Show all versions of iot-service-client Show documentation
The Microsoft Azure IoT Service SDK for Java
The newest version!
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package com.microsoft.azure.sdk.iot.service.digitaltwin;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* A utility to create the JSON patch payload required for update operations such as update digital twin
*/
@SuppressWarnings("UnusedReturnValue") // Public class
public final class UpdateOperationUtility {
private static final String ADD = "add";
private static final String REPLACE = "replace";
private static final String REMOVE = "remove";
private static final ObjectMapper mapper = new ObjectMapper();
private final List operations = new ArrayList<>();
/**
* Gets the JSON patch payload required for update operations.
* @return The JSON patch payload required for update operations.
*/
public List