Class PartitionKeyBuilder

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

public final class PartitionKeyBuilder extends Object
Builder for partition keys.
  • Constructor Details

    • PartitionKeyBuilder

      public PartitionKeyBuilder()
      Constructor. CREATE a new instance of the PartitionKeyBuilder object.
  • Method Details

    • add

      public PartitionKeyBuilder add(String value)
      Adds partition value of type string
      Parameters:
      value - The value of type string to be used as partition key
      Returns:
      The current PartitionKeyBuilder object
    • add

      public PartitionKeyBuilder add(double value)
      Adds partition value of type double
      Parameters:
      value - The value of type double to be used as partition key
      Returns:
      The current PartitionKeyBuilder object
    • add

      public PartitionKeyBuilder add(boolean value)
      Adds partition value of type boolean
      Parameters:
      value - The value of type boolean to be used as partition key
      Returns:
      The current PartitionKeyBuilder object
    • addNullValue

      @Deprecated public PartitionKeyBuilder addNullValue()
      Deprecated.
      Null value should only be used with PartitionKey constructor.
      Adds a null partition key value
      Returns:
      The current PartitionKeyBuilder object
    • addNoneValue

      @Deprecated public PartitionKeyBuilder addNoneValue()
      Deprecated.
      PartitionKey.None value should only be used with PartitionKey constructor.
      Adds a None Partition Key value to the path. An error will be raised if used with other paths.
      Returns:
      The current PartitionKeyBuilder object
    • build

      public PartitionKey build()
      Builds a new instance of the type PartitionKey with the specified Partition Key values.
      Returns:
      PartitionKey object
      Throws:
      IllegalStateException - when using PartitionKey.None with other values