Class PartitionKey

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

public class PartitionKey extends Object
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 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

    • toString

      public String toString()
      Serialize the PartitionKey object to a JSON string.
      Overrides:
      toString in class Object
      Returns:
      the string representation of this PartitionKey object.
    • 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
    • fromItem

      public static PartitionKey fromItem(Map<String,Object> 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
    • equals

      public boolean equals(Object other)
      Overrides the Equal operator for object comparisons between two instances of PartitionKey
      Overrides:
      equals in class Object
      Parameters:
      other - The object to compare with.
      Returns:
      True if two object instance are considered equal.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object