## org.apache.cassandra.dht
Class OrderPreservingPartitioner

    java.lang.Object
      org.apache.cassandra.dht.OrderPreservingPartitioner

All Implemented Interfaces:
  IPartitioner<StringToken>

    public class OrderPreservingPartitioner

extends java.lang.Object
implements IPartitioner<StringToken>

Field Summary
`static java.math.BigInteger` `CHAR_MASK`
`static StringToken` `MINIMUM`

Constructor Summary
`OrderPreservingPartitioner()`

Method Summary
`DecoratedKey<StringToken>` `convertFromDiskFormat(java.lang.String key)` Convert the on disk representation to a DecoratedKey object
`java.lang.String` `convertToDiskFormat(DecoratedKey<StringToken> key)` Convert the DecoratedKey to the on disk format used for this partitioner.
`DecoratedKey<StringToken>` `decorateKey(java.lang.String key)` Transform key to object representation of the on-disk format.
`StringToken` `getMinimumToken()`
`StringToken` `getRandomToken()`
`StringToken` `getToken(java.lang.String key)`
`Token.TokenFactory<java.lang.String>` `getTokenFactory()`
`StringToken` `midpoint(StringToken ltoken, StringToken rtoken)` Calculate a Token representing the approximate "middle" of the given range.
`boolean` `preservesOrder()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MINIMUM

    public static final StringToken MINIMUM

### CHAR_MASK

    public static final java.math.BigInteger CHAR_MASK

Constructor Detail

### OrderPreservingPartitioner

    public OrderPreservingPartitioner()

Method Detail

### decorateKey

    public DecoratedKey<StringToken> decorateKey(java.lang.String key)

  Description copied from interface: `IPartitioner`
  Transform key to object representation of the on-disk format.

  Specified by:
    `decorateKey` in interface `IPartitioner<StringToken>`
  Parameters:
    `key` - the raw, client-facing key
  Returns:
    decorated version of key

### convertFromDiskFormat

    public DecoratedKey<StringToken> convertFromDiskFormat(java.lang.String key)

  Description copied from interface: `IPartitioner`
  Convert the on disk representation to a DecoratedKey object

  Specified by:
    `convertFromDiskFormat` in interface `IPartitioner<StringToken>`
  Parameters:
    `key` - On disk representation
  Returns:
    DecoratedKey object

### convertToDiskFormat

    public java.lang.String convertToDiskFormat(DecoratedKey<StringToken> key)

  Description copied from interface: `IPartitioner`
  Convert the DecoratedKey to the on disk format used for this partitioner.

  Specified by:
    `convertToDiskFormat` in interface `IPartitioner<StringToken>`
  Parameters:
    `key` - The DecoratedKey in question
  Returns:

### midpoint

    public StringToken midpoint(StringToken ltoken,
                                StringToken rtoken)

  Description copied from interface: `IPartitioner`
  Calculate a Token representing the approximate "middle" of the given range.

  Specified by:
    `midpoint` in interface `IPartitioner<StringToken>`
  Returns:
    The approximate midpoint between left and right.

### getMinimumToken

    public StringToken getMinimumToken()

  Specified by:
    `getMinimumToken` in interface `IPartitioner<StringToken>`
  Returns:
    The minimum possible Token in the range that is being partitioned.

### getRandomToken

    public StringToken getRandomToken()

  Specified by:
    `getRandomToken` in interface `IPartitioner<StringToken>`
  Returns:
    a randomly generated token

### getTokenFactory

    public Token.TokenFactory<java.lang.String> getTokenFactory()

  Specified by:
    `getTokenFactory` in interface `IPartitioner<StringToken>`

### preservesOrder

    public boolean preservesOrder()

  Specified by:
    `preservesOrder` in interface `IPartitioner<StringToken>`
  Returns:
    True if the implementing class preserves key order in the Tokens it generates.

### getToken

    public StringToken getToken(java.lang.String key)

  Specified by:
    `getToken` in interface `IPartitioner<StringToken>`
  Returns:
    a Token that can be used to route a given key (This is NOT a method to create a Token from its string representation; for that, use TokenFactory.fromString.)

Copyright © 2010 The Apache Software Foundation