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

org.apache.cassandra.cql3.restrictions

## Class TokenRestriction

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

- Direct Known Subclasses:
    TokenRestriction.EQRestriction, TokenRestriction.SliceRestriction

      public abstract class TokenRestriction
      extends java.lang.Object

  `Restriction` using the token function.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TokenRestriction.EQRestriction`
    `static class` | `TokenRestriction.SliceRestriction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<ColumnDefinition>` | `columnDefs` The definition of the columns to which apply the token restriction.
    `protected CFMetaData` | `metadata`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenRestriction(CFMetaData metadata, java.util.List<ColumnDefinition> columnDefs)` Creates a new `TokenRestriction` that apply to the specified columns.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options)` Adds to the specified row filter the expressions corresponding to this `Restriction`.
    `java.util.List<java.nio.ByteBuffer>` | `bounds(Bound b, QueryOptions options)`
    `protected abstract org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictions` | `doMergeWith(TokenRestriction otherRestriction)` Merges this restriction with the specified `TokenRestriction`.
    `java.util.List<ColumnDefinition>` | `getColumnDefs()` Returns the column definitions in position order.
    `protected java.lang.String` | `getColumnNamesAsString()` Returns the column names as a comma separated `String`.
    `ColumnDefinition` | `getFirstColumn()` Returns the definition of the first column.
    `ColumnDefinition` | `getLastColumn()` Returns the definition of the last column.
    `java.util.Set<Restriction>` | `getRestrictions(ColumnDefinition columnDef)` Returns the restrictions applied to the specified column.
    `boolean` | `hasBound(Bound b)` Checks if the specified bound is set or not.
    `boolean` | `hasIN()` Checks if any of the underlying restriction is an IN.
    `boolean` | `hasOnlyEqualityRestrictions()` Checks if all of the underlying restrictions are EQ or IN restrictions.
    `boolean` | `hasSlice()` Checks if any of the underlying restrictions is a slice.
    `boolean` | `hasSupportingIndex(SecondaryIndexManager secondaryIndexManager)` Check if the restriction is on indexed columns.
    `boolean` | `hasUnrestrictedPartitionKeyComponents(CFMetaData cfm)` Checks if the partition key has unrestricted components.
    `boolean` | `isEmpty()` Checks if this `Restrictions` is empty or not.
    `boolean` | `isInclusive(Bound b)` Checks if the specified bound is inclusive or not.
    `boolean` | `isOnToken()`
    `org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictions` | `mergeWith(Restriction otherRestriction)`
    `boolean` | `needFiltering(CFMetaData cfm)` checks if specified restrictions require filtering
    `int` | `size()` Returns the number of columns that have a restriction.
    `java.util.List<java.nio.ByteBuffer>` | `values(QueryOptions options)`

    - ### 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.Restrictions

      `hasContains`

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

      `addFunctionsTo`

- - ### Field Detail

    - #### columnDefs

          protected final java.util.List<ColumnDefinition> columnDefs

      The definition of the columns to which apply the token restriction.

    - #### metadata

          protected final CFMetaData metadata

  - ### Constructor Detail

    - #### TokenRestriction

          public TokenRestriction(CFMetaData metadata,
                                  java.util.List<ColumnDefinition> columnDefs)

      Creates a new `TokenRestriction` that apply to the specified columns.
      Parameters:
        `columnDefs` - the definition of the columns to which apply the token restriction

  - ### Method Detail

    - #### hasIN

          public boolean hasIN()

      Description copied from interface: `Restrictions`
      Checks if any of the underlying restriction is an IN.
      Returns:
        `true` if any of the underlying restriction is an IN, `false` otherwise

    - #### hasOnlyEqualityRestrictions

          public boolean hasOnlyEqualityRestrictions()

      Description copied from interface: `Restrictions`
      Checks if all of the underlying restrictions are EQ or IN restrictions.
      Returns:
        `true` if all of the underlying restrictions are EQ or IN restrictions, `false` otherwise

    - #### getRestrictions

          public java.util.Set<Restriction> getRestrictions(ColumnDefinition columnDef)

      Description copied from interface: `Restrictions`
      Returns the restrictions applied to the specified column.
      Parameters:
        `columnDef` - the column definition
      Returns:
        the restrictions applied to the specified column

    - #### isOnToken

          public final boolean isOnToken()

    - #### needFiltering

          public boolean needFiltering(CFMetaData cfm)

      checks if specified restrictions require filtering
      Parameters:
        `cfm` - column family metadata
      Returns:
        `true` if filtering is required, `false` otherwise

    - #### hasSlice

          public boolean hasSlice()

      Description copied from interface: `Restrictions`
      Checks if any of the underlying restrictions is a slice.
      Returns:
        `true` if any of the underlying restrictions is a slice, `false` otherwise

    - #### hasUnrestrictedPartitionKeyComponents

          public boolean hasUnrestrictedPartitionKeyComponents(CFMetaData cfm)

      Checks if the partition key has unrestricted components.
      Parameters:
        `cfm` - column family metadata
      Returns:
        `true` if the partition key has unrestricted components, `false` otherwise.

    - #### 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 secondaryIndexManager)

      Description copied from interface: `Restriction`
      Check if the restriction is on indexed columns.
      Parameters:
        `secondaryIndexManager` - the index manager
      Returns:
        `true` if the restriction is on indexed columns, `false`

    - #### addRowFilterTo

          public void addRowFilterTo(RowFilter filter,
                                     SecondaryIndexManager indexManager,
                                     QueryOptions options)

      Description copied from interface: `Restriction`
      Adds to the specified row filter the expressions corresponding to this `Restriction`.
      Parameters:
        `filter` - the row filter to add expressions to
        `indexManager` - the secondary index manager
        `options` - the query options

    - #### isEmpty

          public final boolean isEmpty()

      Description copied from interface: `Restrictions`
      Checks if this `Restrictions` is empty or not.
      Returns:
        `true` if this `Restrictions` is empty, `false` otherwise.

    - #### size

          public final int size()

      Description copied from interface: `Restrictions`
      Returns the number of columns that have a restriction.
      Returns:
        the number of columns that have a restriction.

    - #### getColumnNamesAsString

          protected final java.lang.String getColumnNamesAsString()

      Returns the column names as a comma separated `String`.
      Returns:
        the column names as a comma separated `String`.

    - #### mergeWith

          public final org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictions mergeWith(Restriction otherRestriction)
                                                                                          throws InvalidRequestException

      Throws:
        `InvalidRequestException`

    - #### doMergeWith

          protected abstract org.apache.cassandra.cql3.restrictions.PartitionKeyRestrictions doMergeWith(TokenRestriction otherRestriction)
                                                                                                  throws InvalidRequestException

      Merges this restriction with the specified `TokenRestriction`.
      Parameters:
        `otherRestriction` - the `TokenRestriction` to merge with.
      Throws:
        `InvalidRequestException`

    - #### values

          public java.util.List<java.nio.ByteBuffer> values(QueryOptions options)

    - #### bounds

          public java.util.List<java.nio.ByteBuffer> bounds(Bound b,
                                                            QueryOptions options)

    - #### hasBound

          public 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

          public 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

Copyright © 2018 The Apache Software Foundation