DecoratedKey (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.db

## Class DecoratedKey

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

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

      public abstract class DecoratedKey
      extends java.lang.Object
      implements RowPosition

  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.RowPosition

      `RowPosition.ForKey, RowPosition.Kind, RowPosition.RowPositionSerializer`

  - ### Field Summary

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

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

      `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DecoratedKey(Token token)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `compareTo(IPartitioner partitioner, java.nio.ByteBuffer key, RowPosition position)`
    `int` | `compareTo(RowPosition pos)`
    `boolean` | `equals(java.lang.Object obj)`
    `abstract java.nio.ByteBuffer` | `getKey()`
    `Token` | `getToken()`
    `int` | `hashCode()`
    `boolean` | `isMinimum()`
    `boolean` | `isMinimum(IPartitioner partitioner)`
    `RowPosition.Kind` | `kind()`
    `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(RowPosition pos)

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

    - #### compareTo

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

    - #### isMinimum

          public boolean isMinimum(IPartitioner partitioner)

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

    - #### isMinimum

          public boolean isMinimum()

      Specified by:
        `isMinimum` in interface `RowPosition`

    - #### kind

          public RowPosition.Kind kind()

      Specified by:
        `kind` in interface `RowPosition`

    - #### toString

          public java.lang.String toString()

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

    - #### getToken

          public Token getToken()

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

    - #### getKey

          public abstract java.nio.ByteBuffer getKey()

Copyright © 2014 The Apache Software Foundation