Freigeben über


PartitionKeyDefinition Class

public final class PartitionKeyDefinition
extends JsonSerializable

Represents a partition key definition in the Azure Cosmos DB database service. A partition key definition specifies which document property is used as the partition key in a collection that has multiple partitions.

Constructor Summary

Constructor Description
PartitionKeyDefinition()

Constructor.

PartitionKeyDefinition(String jsonString)

Constructor.

PartitionKeyDefinition(JSONObject jsonObject)

Constructor.

Method Summary

Modifier and Type Method and Description
PartitionKind getKind()

Sets the partition algorithm used to calculate the partition id given a partition key.

java.util.Collection<java.lang.String> getPaths()

Gets the document property paths for the partition key.

PartitionKeyDefinitionVersion getVersion()
void setKind(PartitionKind kind)

Sets the partition algorithm used to calculate the partition id given a partition key.

void setPaths(Collection<String> paths)

Sets the document property paths for the partition key.

void setVersion(PartitionKeyDefinitionVersion version)

Methods inherited from JsonSerializable

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

PartitionKeyDefinition

public PartitionKeyDefinition()

Constructor. Creates a new instance of the PartitionKeyDefinition object.

PartitionKeyDefinition

public PartitionKeyDefinition(String jsonString)

Constructor. Creates a new instance of the PartitionKeyDefinition object from a JSON string.

Parameters:

jsonString - the JSON string that represents the partition key definition.

PartitionKeyDefinition

public PartitionKeyDefinition(JSONObject jsonObject)

Constructor. Creates a new instance of the PartitionKeyDefinition object from a JSON object.

Parameters:

jsonObject - the JSON object that represents the partition key definition.

Method Details

getKind

public PartitionKind getKind()

Sets the partition algorithm used to calculate the partition id given a partition key.

Returns:

the partition algorithm.

getPaths

public Collection getPaths()

Gets the document property paths for the partition key.

Returns:

the paths to the document properties that form the partition key.

getVersion

public PartitionKeyDefinitionVersion getVersion()

setKind

public void setKind(PartitionKind kind)

Sets the partition algorithm used to calculate the partition id given a partition key.

Parameters:

kind - the partition algorithm.

setPaths

public void setPaths(Collection paths)

Sets the document property paths for the partition key.

Parameters:

paths - the paths to document properties that form the partition key.

setVersion

public void setVersion(PartitionKeyDefinitionVersion version)

Parameters:

version

Applies to