org.apache.cassandra.cql3.restrictions

## Interface Restriction

- All Known Implementing Classes:
    MultiColumnRestriction, MultiColumnRestriction.EQ, MultiColumnRestriction.IN, MultiColumnRestriction.InWithMarker, MultiColumnRestriction.InWithValues, MultiColumnRestriction.Slice, SingleColumnRestriction, SingleColumnRestriction.Contains, SingleColumnRestriction.EQ, SingleColumnRestriction.IN, SingleColumnRestriction.InWithMarker, SingleColumnRestriction.InWithValues, SingleColumnRestriction.Slice, TokenRestriction, TokenRestriction.EQ, TokenRestriction.Slice

      public interface Restriction

  A restriction/clause on a column. The goal of this class being to group all conditions for a column in a SELECT.

  Implementation of this class must be immutable. See `mergeWith(Restriction)` for more explanation.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addIndexExpressionTo(java.util.List<IndexExpression> expressions, SecondaryIndexManager indexManager, QueryOptions options)` Adds to the specified list the `IndexExpression`s corresponding to this `Restriction`.
    `CompositesBuilder` | `appendBoundTo(CFMetaData cfm, CompositesBuilder builder, Bound bound, QueryOptions options)` Appends the values of the `Restriction` for the specified bound to the specified builder.
    `CompositesBuilder` | `appendTo(CFMetaData cfm, CompositesBuilder builder, QueryOptions options)` Appends the values of this `Restriction` to the specified builder.
    `java.util.List<ColumnDefinition>` | `getColumnDefs()` Returns the column definitions in position order.
    `ColumnDefinition` | `getFirstColumn()` Returns the definition of the first column.
    `java.lang.Iterable<Function>` | `getFunctions()` Return an Iterable over all of the functions (both native and user-defined) used by any component of the restriction
    `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()`
    `Restriction` | `mergeWith(Restriction otherRestriction)` Merges this restriction with the specified one.

- - ### Method Detail

    - #### isOnToken

          boolean isOnToken()

    - #### isSlice

          boolean isSlice()

    - #### isEQ

          boolean isEQ()

    - #### isIN

          boolean isIN()

    - #### isContains

          boolean isContains()

    - #### isMultiColumn

          boolean isMultiColumn()

    - #### getFirstColumn

          ColumnDefinition getFirstColumn()

      Returns the definition of the first column.
      Returns:
        the definition of the first column.

    - #### getLastColumn

          ColumnDefinition getLastColumn()

      Returns the definition of the last column.
      Returns:
        the definition of the last column.

    - #### getColumnDefs

          java.util.List<ColumnDefinition> getColumnDefs()

      Returns the column definitions in position order.
      Returns:
        the column definitions in position order.

    - #### getFunctions

          java.lang.Iterable<Function> getFunctions()

      Return an Iterable over all of the functions (both native and user-defined) used by any component of the restriction
      Returns:
        functions all functions found (may contain duplicates)

    - #### hasBound

          boolean hasBound(Bound b)

      Checks if the specified bound is set or not.
      Parameters:
        `b` - the bound type
      Returns:
        `true` if the specified bound is set, `false` otherwise

    - #### isInclusive

          boolean isInclusive(Bound b)

      Checks if the specified bound is inclusive or not.
      Parameters:
        `b` - the bound type
      Returns:
        `true` if the specified bound is inclusive, `false` otherwise

    - #### mergeWith

          Restriction mergeWith(Restriction otherRestriction)
                         throws InvalidRequestException

      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

    - #### hasSupportingIndex

          boolean hasSupportingIndex(SecondaryIndexManager indexManager)

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

    - #### addIndexExpressionTo

          void addIndexExpressionTo(java.util.List<IndexExpression> expressions,
                                    SecondaryIndexManager indexManager,
                                    QueryOptions options)
                             throws InvalidRequestException

      Adds to the specified list the `IndexExpression`s corresponding to this `Restriction`.
      Parameters:
        `expressions` - the list to add the `IndexExpression`s to
        `indexManager` - the secondary index manager
        `options` - the query options
      Throws:
        `InvalidRequestException` - if this `Restriction` cannot be converted into `IndexExpression`s

    - #### appendTo

          CompositesBuilder appendTo(CFMetaData cfm,
                                     CompositesBuilder builder,
                                     QueryOptions options)

      Appends the values of this `Restriction` to the specified builder.
      Parameters:
        `cfm` - the table metadata
        `builder` - the `CompositesBuilder` to append to.
        `options` - the query options
      Returns:
        the `CompositesBuilder`

    - #### appendBoundTo

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

      Appends the values of the `Restriction` for the specified bound to the specified builder.
      Parameters:
        `cfm` - the table metadata
        `builder` - the `CompositesBuilder` to append to.
        `bound` - the bound
        `options` - the query options
      Returns:
        the `CompositesBuilder`

    - #### isNotReturningAnyRows

          boolean isNotReturningAnyRows(CFMetaData cfm,
                                        QueryOptions options)

      Checks if this restriction will prevent the query to return any rows.
      Parameters:
        `cfm` - the table metadata
        `options` - the query options
      Returns:
        `true` if this restriction will prevent the query to return any rows, otherwise

Copyright © 2018 The Apache Software Foundation