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

com.azure.cosmos.models.CosmosItemIdentity 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.61.1
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.cosmos.models;

/**
 * Encapsulates the PartitionKey/id tuple that uniquely identifies a CosmosItem
 */
public final class CosmosItemIdentity {
    private final PartitionKey partitionKey;
    private final String id;

    /**
     * Instantiates an instance of the CosmosItemIdentity class
     * @param partitionKey the partition key - must not be null
     * @param id the item id value - must be unique within the scope of a logical partition, must not be null or empty
     */
    public CosmosItemIdentity(PartitionKey partitionKey, String id) {

        if (partitionKey == null) {
            throw new IllegalArgumentException("partitionKey is null.");
        }

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("id is null or empty");
        }

        this.partitionKey = partitionKey;
        this.id = id;
    }

    /**
     * 

Gets the partition key

* * @return the partition key - must not be null */ public PartitionKey getPartitionKey() { return this.partitionKey; } /** *

Gets the id value uniquely identifying this item within the scope of a logical partition

* * @return the id value uniquely identifying this item within the scope of a logical * partition - must not be null or empty */ public String getId() { return this.id; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy