org.apache.cassandra.cql3.restrictions

## Class SingleColumnRestriction

- java.lang.Object
- - org.apache.cassandra.cql3.restrictions.SingleColumnRestriction

All Implemented Interfaces:
  Restriction

Direct Known Subclasses:
  SingleColumnRestriction.Contains, SingleColumnRestriction.EQ, SingleColumnRestriction.IN, SingleColumnRestriction.Slice

    public abstract class SingleColumnRestriction
    extends java.lang.Object

### Nested Class Summary

Nested Classes
`static class` `SingleColumnRestriction.Contains`
`static class` `SingleColumnRestriction.EQ`
`static class` `SingleColumnRestriction.IN`
`static class` `SingleColumnRestriction.InWithMarker`
`static class` `SingleColumnRestriction.InWithValues`
`static class` `SingleColumnRestriction.Slice`

### Field Summary

Fields
`protected ColumnDefinition` `columnDef` The definition of the column to which apply the restriction.

### Constructor Summary

Constructors
Constructor and Description
`SingleColumnRestriction(ColumnDefinition columnDef)`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`CompositesBuilder` `appendBoundTo(CFMetaData cfm, CompositesBuilder builder, Bound bound, QueryOptions options)` Appends the values of the `Restriction` for the specified bound to the specified builder.
`protected abstract Restriction` `doMergeWith(Restriction otherRestriction)`
`java.util.List<ColumnDefinition>` `getColumnDefs()` Returns the column definitions in position order.
`ColumnDefinition` `getFirstColumn()` Returns the definition of the first column.
`ColumnDefinition` `getLastColumn()` Returns the definition of the last column.
`boolean` `hasBound(Bound b)` Checks if the specified bound is set or not.
`boolean` `hasSupportingIndex(SecondaryIndexManager indexManager)` Check if the restriction is on indexed columns.
`boolean` `isContains()`
`boolean` `isEQ()`
`boolean` `isIN()`
`boolean` `isInclusive(Bound b)` Checks if the specified bound is inclusive or not.
`boolean` `isMultiColumn()`
`boolean` `isNotReturningAnyRows(CFMetaData cfm, QueryOptions options)` Checks if this restriction will prevent the query to return any rows.
`boolean` `isOnToken()`
`boolean` `isSlice()`
`protected abstract boolean` `isSupportedBy(SecondaryIndex index)` Check if this type of restriction is supported by the specified index.
`Restriction` `mergeWith(Restriction otherRestriction)` Merges this restriction with the specified one.
`protected static Bound` `reverseBoundIfNeeded(ColumnDefinition columnDefinition, Bound bound)` Reverses the specified bound if the column type is a reversed one.
`protected static java.nio.ByteBuffer` `validateIndexedValue(ColumnSpecification columnSpec, java.nio.ByteBuffer value)`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.cassandra.cql3.restrictions.Restriction

`addIndexExpressionTo, appendTo, getFunctions`

### Field Detail

#### columnDef

    protected final ColumnDefinition columnDef

The definition of the column to which apply the restriction.

### Constructor Detail

#### SingleColumnRestriction

    public SingleColumnRestriction(ColumnDefinition columnDef)

### Method Detail

#### getColumnDefs

    public java.util.List<ColumnDefinition> getColumnDefs()

Description copied from interface: `Restriction`
Returns the column definitions in position order.

Returns:
  the column definitions in position order.

#### getFirstColumn

    public ColumnDefinition getFirstColumn()

Description copied from interface: `Restriction`
Returns the definition of the first column.

Returns:
  the definition of the first column.

#### getLastColumn

    public ColumnDefinition getLastColumn()

Description copied from interface: `Restriction`
Returns the definition of the last column.

Returns:
  the definition of the last column.

#### hasSupportingIndex

    public boolean hasSupportingIndex(SecondaryIndexManager indexManager)

Description copied from interface: `Restriction`
Check if the restriction is on indexed columns.

Parameters:
  `indexManager` - the index manager
Returns:
  `true` if the restriction is on indexed columns, `false`

#### mergeWith

    public final Restriction mergeWith(Restriction otherRestriction)
                                throws InvalidRequestException

Description copied from interface: `Restriction`
Merges this restriction with the specified one.

Restriction are immutable. Therefore merging two restrictions result in a new one. The reason behind this choice is that it allow a great flexibility in the way the merging can done while preventing any side effect.

Parameters:
  `otherRestriction` - the restriction to merge into this one
Returns:
  the restriction resulting of the merge
Throws:
  `InvalidRequestException` - if the restrictions cannot be merged

#### doMergeWith

    protected abstract Restriction doMergeWith(Restriction otherRestriction)
                                        throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### isSupportedBy

    protected abstract boolean isSupportedBy(SecondaryIndex index)

Check if this type of restriction is supported by the specified index.

Parameters:
  `index` - the Secondary index
Returns:
  `true` this type of restriction is supported by the specified index, `false` otherwise.

#### isOnToken

    public boolean isOnToken()

Specified by:
  `isOnToken` in interface `Restriction`

#### isMultiColumn

    public boolean isMultiColumn()

Specified by:
  `isMultiColumn` in interface `Restriction`

#### isSlice

    public boolean isSlice()

Specified by:
  `isSlice` in interface `Restriction`

#### isEQ

    public boolean isEQ()

Specified by:
  `isEQ` in interface `Restriction`

#### isIN

    public boolean isIN()

Specified by:
  `isIN` in interface `Restriction`

#### isContains

    public boolean isContains()

Specified by:
  `isContains` in interface `Restriction`

#### hasBound

    public boolean hasBound(Bound b)

Description copied from interface: `Restriction`
Checks if the specified bound is set or not.

Specified by:
  `hasBound` in interface `Restriction`
Parameters:
  `b` - the bound type
Returns:
  `true` if the specified bound is set, `false` otherwise

#### appendBoundTo

    public CompositesBuilder appendBoundTo(CFMetaData cfm,
                                           CompositesBuilder builder,
                                           Bound bound,
                                           QueryOptions options)

Description copied from interface: `Restriction`
Appends the values of the `Restriction` for the specified bound to the specified builder.

Specified by:
  `appendBoundTo` in interface `Restriction`
Parameters:
  `cfm` - the table metadata
  `builder` - the `CompositesBuilder` to append to.
  `bound` - the bound
  `options` - the query options
Returns:
  the `CompositesBuilder`

#### isInclusive

    public boolean isInclusive(Bound b)

Description copied from interface: `Restriction`
Checks if the specified bound is inclusive or not.

Specified by:
  `isInclusive` in interface `Restriction`
Parameters:
  `b` - the bound type
Returns:
  `true` if the specified bound is inclusive, `false` otherwise

#### isNotReturningAnyRows

    public boolean isNotReturningAnyRows(CFMetaData cfm,
                                         QueryOptions options)

Description copied from interface: `Restriction`
Checks if this restriction will prevent the query to return any rows.

Specified by:
  `isNotReturningAnyRows` in interface `Restriction`
Parameters:
  `cfm` - the table metadata
  `options` - the query options
Returns:
  `true` if this restriction will prevent the query to return any rows, otherwise

#### validateIndexedValue

    protected static java.nio.ByteBuffer validateIndexedValue(ColumnSpecification columnSpec,
                                                              java.nio.ByteBuffer value)
                                                       throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### reverseBoundIfNeeded

    protected static Bound reverseBoundIfNeeded(ColumnDefinition columnDefinition,
                                                Bound bound)

Reverses the specified bound if the column type is a reversed one.

Parameters:
  `columnDefinition` - the column definition
  `bound` - the bound
Returns:
  the bound reversed if the column type was a reversed one or the original bound