org.apache.cassandra.db

## Class DecoratedKey

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

All Implemented Interfaces:
  java.lang.Comparable<RowPosition>, RowPosition, RingPosition<RowPosition>, IFilter.FilterKey

Direct Known Subclasses:
  BufferDecoratedKey, NativeDecoratedKey

    public abstract class DecoratedKey
    extends java.lang.Object
    implements RowPosition, 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.RowPosition

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

### Field Summary

Fields
`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

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`static int` `compareTo(IPartitioner partitioner, java.nio.ByteBuffer key, RowPosition position)`
`int` `compareTo(RowPosition 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()`
`RowPosition.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(RowPosition pos)

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

#### compareTo

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

#### getPartitioner

    public IPartitioner getPartitioner()

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

#### minValue

    public Token.KeyBound minValue()

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

#### isMinimum

    public boolean isMinimum()

Specified by:
  `isMinimum` in interface `RowPosition`
Specified by:
  `isMinimum` in interface `RingPosition<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()

#### 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`