DecoratedKey (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db

## Class DecoratedKey

- java.lang.Object
- - org.apache.cassandra.db.DecoratedKey

- All Implemented Interfaces:
    java.lang.Comparable<PartitionPosition>, PartitionPosition, RingPosition<PartitionPosition>, IFilter.FilterKey
  Direct Known Subclasses:
    BufferDecoratedKey, NativeDecoratedKey

      public abstract class DecoratedKey
      extends java.lang.Object
      implements PartitionPosition, IFilter.FilterKey

  Represents a decorated key, handy for certain operations where just working with strings gets slow. We do a lot of sorting of DecoratedKeys, so for speed, we assume that tokens correspond one-to-one with keys. This is not quite correct in the case of RandomPartitioner (which uses MD5 to hash keys to tokens); if this matters, you can subclass RP to use a stronger hash, or use a non-lossy tokenization scheme (as in the OrderPreservingPartitioner classes).

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.db.PartitionPosition

      `PartitionPosition.ForKey, PartitionPosition.Kind, PartitionPosition.RowPositionSerializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.Comparator<DecoratedKey>` | `comparator`

    - ### Fields inherited from interface org.apache.cassandra.db.PartitionPosition

      `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DecoratedKey(Token token)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `compareTo(IPartitioner partitioner, java.nio.ByteBuffer key, PartitionPosition position)`
    `int` | `compareTo(PartitionPosition pos)`
    `boolean` | `equals(java.lang.Object obj)`
    `void` | `filterHash(long[] dest)` Places the murmur3 hash of the key in the given long array of size at least two.
    `abstract java.nio.ByteBuffer` | `getKey()`
    `IPartitioner` | `getPartitioner()`
    `Token` | `getToken()`
    `int` | `hashCode()`
    `boolean` | `isMinimum()`
    `PartitionPosition.Kind` | `kind()`
    `Token.KeyBound` | `minValue()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### comparator

          public static final java.util.Comparator<DecoratedKey> comparator

  - ### Constructor Detail

    - #### DecoratedKey

          public DecoratedKey(Token token)

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(PartitionPosition pos)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<PartitionPosition>`

    - #### compareTo

          public static int compareTo(IPartitioner partitioner,
                                      java.nio.ByteBuffer key,
                                      PartitionPosition position)

    - #### getPartitioner

          public IPartitioner getPartitioner()

      Specified by:
        `getPartitioner` in interface `RingPosition<PartitionPosition>`

    - #### minValue

          public Token.KeyBound minValue()

      Specified by:
        `minValue` in interface `RingPosition<PartitionPosition>`

    - #### isMinimum

          public boolean isMinimum()

      Specified by:
        `isMinimum` in interface `PartitionPosition`
      Specified by:
        `isMinimum` in interface `RingPosition<PartitionPosition>`

    - #### kind

          public PartitionPosition.Kind kind()

      Specified by:
        `kind` in interface `PartitionPosition`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getToken

          public Token getToken()

      Specified by:
        `getToken` in interface `RingPosition<PartitionPosition>`

    - #### getKey

          public abstract java.nio.ByteBuffer getKey()

    - #### filterHash

          public void filterHash(long[] dest)

      Description copied from interface: `IFilter.FilterKey`
      Places the murmur3 hash of the key in the given long array of size at least two.
      Specified by:
        `filterHash` in interface `IFilter.FilterKey`

Copyright © 2018 The Apache Software Foundation