Freigeben über


PartitionKey Class

  • java.lang.Object
    • com.azure.cosmos.models.PartitionKey

public class PartitionKey

Represents a partition key value in the Azure Cosmos DB database service. A partition key identifies the partition where the item is stored in.

Field Summary

Modifier and Type Field and Description
static final PartitionKey NONE

Partition key that represents no partition key.

Constructor Summary

Constructor Description
PartitionKey(Object key)

Constructor.

Method Summary

Modifier and Type Method and Description
boolean equals(Object other)

Overrides the Equal operator for object comparisons between two instances of PartitionKey

static PartitionKey fromItem(Map<String,Object> item, PartitionKeyDefinition partitionKeyDefinition)

Returns the PartitionKey extracted from the item

static PartitionKey fromObjectArray(Object[] values, boolean strict)

Returns the PartitionKey from an array of objects that is generated by PartitionKeyInternal

int hashCode()
String toString()

Serialize the PartitionKey object to a JSON string.

Methods inherited from java.lang.Object

Field Details

NONE

public static final PartitionKey NONE

Partition key that represents no partition key.

Constructor Details

PartitionKey

public PartitionKey(Object key)

Constructor. CREATE a new instance of the PartitionKey object.

Parameters:

key - the value of the partition key.

Method Details

equals

public boolean equals(Object other)

Overrides the Equal operator for object comparisons between two instances of PartitionKey

Overrides:

PartitionKey.equals(Object other)

Parameters:

other - The object to compare with.

Returns:

True if two object instance are considered equal.

fromItem

public static PartitionKey fromItem(Map item, PartitionKeyDefinition partitionKeyDefinition)

Returns the PartitionKey extracted from the item

Parameters:

item - The JsonSerializable object to get the PartitionKey value from
partitionKeyDefinition - The PartitionKeyDefinition to use to extract the PartitionKey value

Returns:

The PartitionKey

fromObjectArray

public static PartitionKey fromObjectArray(Object[] values, boolean strict)

Returns the PartitionKey from an array of objects that is generated by PartitionKeyInternal

Parameters:

values - The object array of values to construct the PartitionKey with
strict - The boolean value for if to use strict on object types

Returns:

The PartitionKey

hashCode

public int hashCode()

Overrides:

PartitionKey.hashCode()

toString

public String toString()

Serialize the PartitionKey object to a JSON string.

Overrides:

PartitionKey.toString()

Returns:

the string representation of this PartitionKey object.

Applies to