org.apache.cassandra.cql3.selection

## Class Selector.Factory

- java.lang.Object
- - org.apache.cassandra.cql3.selection.Selector.Factory

Enclosing class:
  Selector

    public abstract static class Selector.Factory
    extends java.lang.Object

A factory for `Selector` instances.

### Constructor Summary

Constructors
Constructor and Description
`Factory()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract void` `addColumnMapping(SelectionColumnMapping mapping, ColumnSpecification resultsColumn)` Record a mapping between the ColumnDefinitions that are used by the selector instances created by this factory and a column in the ResultSet.Metadata returned with a query.
`void` `addFunctionsTo(java.util.List<Function> functions)`
`protected abstract java.lang.String` `getColumnName()` Returns the name of the column corresponding to the output value of the selector instances created by this factory.
`ColumnSpecification` `getColumnSpecification(CFMetaData cfm)` Returns the column specification corresponding to the output value of the selector instances created by this factory.
`protected abstract AbstractType<?>` `getReturnType()` Returns the type of the values returned by the selector instances created by this factory.
`boolean` `isAggregateSelectorFactory()` Checks if this factory creates selectors instances that creates aggregates.
`boolean` `isSimpleSelectorFactory(int index)` Checks if this factory creates `Selector`s that simply return the specified column.
`boolean` `isTTLSelectorFactory()` Checks if this factory creates `TTL` selectors instances.
`boolean` `isWritetimeSelectorFactory()` Checks if this factory creates `writetime` selectors instances.
`abstract Selector` `newInstance(QueryOptions options)` Creates a new `Selector` instance.

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

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

### Constructor Detail

#### Factory

    public Factory()

### Method Detail

#### addFunctionsTo

    public void addFunctionsTo(java.util.List<Function> functions)

#### getColumnSpecification

    public final ColumnSpecification getColumnSpecification(CFMetaData cfm)

Returns the column specification corresponding to the output value of the selector instances created by this factory.

Parameters:
  `cfm` - the column family meta data
Returns:
  a column specification

#### newInstance

    public abstract Selector newInstance(QueryOptions options)
                                  throws InvalidRequestException

Creates a new `Selector` instance.

Parameters:
  `options` - the options of the query for which the instance is created (some selector depends on the bound values in particular).
Returns:
  a new `Selector` instance
Throws:
  `InvalidRequestException`

#### isAggregateSelectorFactory

    public boolean isAggregateSelectorFactory()

Checks if this factory creates selectors instances that creates aggregates.

Returns:
  `true` if this factory creates selectors instances that creates aggregates, `false` otherwise

#### isWritetimeSelectorFactory

    public boolean isWritetimeSelectorFactory()

Checks if this factory creates `writetime` selectors instances.

Returns:
  `true` if this factory creates `writetime` selectors instances, `false` otherwise

#### isTTLSelectorFactory

    public boolean isTTLSelectorFactory()

Checks if this factory creates `TTL` selectors instances.

Returns:
  `true` if this factory creates `TTL` selectors instances, `false` otherwise

#### isSimpleSelectorFactory

    public boolean isSimpleSelectorFactory(int index)

Checks if this factory creates `Selector`s that simply return the specified column.

Parameters:
  `index` - the column index
Returns:
  `true` if this factory creates `Selector`s that simply return the specified column, `false` otherwise.

#### getColumnName

    protected abstract java.lang.String getColumnName()

Returns the name of the column corresponding to the output value of the selector instances created by this factory.

Returns:
  a column name

#### getReturnType

    protected abstract AbstractType<?> getReturnType()

Returns the type of the values returned by the selector instances created by this factory.

Returns:
  the selector output type

#### addColumnMapping

    protected abstract void addColumnMapping(SelectionColumnMapping mapping,
                                             ColumnSpecification resultsColumn)

Record a mapping between the ColumnDefinitions that are used by the selector instances created by this factory and a column in the ResultSet.Metadata returned with a query. In most cases, this is likely to be a 1:1 mapping, but some selector instances may utilise multiple columns (or none at all) to produce a value (i.e. functions).

Parameters:
  `mapping` - the instance of the column mapping belonging to the current query's Selection
  `resultsColumn` - the column in the ResultSet.Metadata to which the ColumnDefinitions used by the Selector are to be mapped