All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.cosmos.implementation.OperationKind Maven / Gradle / Ivy

Go to download

This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension Reactor support) for Azure Cosmos DB SQL API

There is a newer version: 4.63.3
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.cosmos.implementation;

import java.util.HashMap;
import java.util.Map;

/**
 * Types of operation in Azure Cosmos DB result in conflict
 */
public enum OperationKind {
    CREATE("create"),
    DELETE("delete"),
    REPLACE("replace"),
    UPDATE("update"),
    UNKNOWN("unknown");

    private final String stringValue;
    private static Map operationKindHashMap = new HashMap<>();
    static {
        for (OperationKind cl : OperationKind.values()) {
            operationKindHashMap.put(cl.toString(), cl);
        }
    }
    OperationKind(String stringValue) {
        this.stringValue = stringValue;
    }

    /**
     * Given the over wire version of OperationKind gives the corresponding enum or return UNKNOWN
     *
     * @param operationKind String value of OperationKind
     * @return OperationKind Enum operation kind
     */
    static OperationKind fromServiceSerializedFormat(String operationKind) {

        OperationKind operationKindEnum = operationKindHashMap.get(operationKind);
        if (operationKindEnum == null) {
            operationKindEnum = OperationKind.UNKNOWN;
        }

        return operationKindEnum;
    }

    @Override
    public String toString() {
        return this.stringValue;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy