org.apache.cassandra.config

## Class ColumnDefinition

- java.lang.Object
- - org.apache.cassandra.cql3.ColumnSpecification
  - - org.apache.cassandra.config.ColumnDefinition

All Implemented Interfaces:
  java.lang.Comparable<ColumnDefinition>, AssignmentTestable, Selectable

    public class ColumnDefinition
    extends ColumnSpecification
    implements Selectable, java.lang.Comparable<ColumnDefinition>

### Nested Class Summary

Nested Classes
`static class` `ColumnDefinition.ClusteringOrder`
`static class` `ColumnDefinition.Kind`
`static class` `ColumnDefinition.Raw` Because Thrift-created tables may have a non-text comparator, we cannot determine the proper 'key' until we know the comparator.

### Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.selection.Selectable

`Selectable.WithCast, Selectable.WithFieldSelection, Selectable.WithFunction, Selectable.WithTerm, Selectable.WithToJSonFunction, Selectable.WritetimeOrTTL`

### Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable

`AssignmentTestable.TestResult`

### Field Summary

Fields
`static java.util.Comparator<java.lang.Object>` `asymmetricColumnDataComparator`
`ColumnDefinition.Kind` `kind`
`static int` `NO_POSITION`

### Fields inherited from class org.apache.cassandra.cql3.ColumnSpecification

`cfName, ksName, name, type`

### Constructor Summary

Constructors
Constructor and Description
`ColumnDefinition(CFMetaData cfm, java.nio.ByteBuffer name, AbstractType<?> type, int position, ColumnDefinition.Kind kind)`
`ColumnDefinition(java.lang.String ksName, java.lang.String cfName, ColumnIdentifier name, AbstractType<?> type, int position, ColumnDefinition.Kind kind)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`java.util.Comparator<java.lang.Object>` `asymmetricCellPathComparator()`
`java.util.Comparator<? super Cell>` `cellComparator()`
`java.util.Comparator<CellPath>` `cellPathComparator()`
`CellPath.Serializer` `cellPathSerializer()`
`AbstractType<?>` `cellValueType()` The type of the cell values for cell belonging to this column.
`static ColumnDefinition` `clusteringDef(CFMetaData cfm, java.nio.ByteBuffer name, AbstractType<?> type, int position)`
`static ColumnDefinition` `clusteringDef(java.lang.String ksName, java.lang.String cfName, java.lang.String name, AbstractType<?> type, int position)`
`ColumnDefinition.ClusteringOrder` `clusteringOrder()`
`int` `compareTo(ColumnDefinition other)`
`ColumnDefinition` `copy()`
`java.lang.String` `debugString()`
`boolean` `equals(java.lang.Object o)`
`AbstractType<?>` `getExactTypeIfKnown(java.lang.String keyspace)` The type of the `Selectable` if it can be infered.
`int` `hashCode()`
`boolean` `isClusteringColumn()`
`boolean` `isComplex()`
`boolean` `isCounterColumn()`
`boolean` `isPartitionKey()`
`boolean` `isPartOfCellName(boolean isCQL3Table, boolean isSuper)` Whether the name of this definition is serialized in the cell nane, i.e.
`boolean` `isPrimaryKeyColumn()`
`boolean` `isRegular()`
`boolean` `isSimple()`
`boolean` `isStatic()`
`Selector.Factory` `newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, java.util.List<ColumnDefinition> defs, VariableSpecifications boundNames)`
`static ColumnDefinition` `partitionKeyDef(CFMetaData cfm, java.nio.ByteBuffer name, AbstractType<?> type, int position)`
`static ColumnDefinition` `partitionKeyDef(java.lang.String ksName, java.lang.String cfName, java.lang.String name, AbstractType<?> type, int position)`
`int` `position()`
`static ColumnDefinition` `regularDef(CFMetaData cfm, java.nio.ByteBuffer name, AbstractType<?> type)`
`static ColumnDefinition` `regularDef(java.lang.String ksName, java.lang.String cfName, java.lang.String name, AbstractType<?> type)`
`static ColumnDefinition` `staticDef(CFMetaData cfm, java.nio.ByteBuffer name, AbstractType<?> type)`
`static java.lang.String` `toCQLString(java.lang.Iterable<ColumnDefinition> defs)`
`static java.lang.String` `toCQLString(java.util.Iterator<ColumnDefinition> defs)`
`static java.util.Collection<ColumnIdentifier>` `toIdentifiers(java.util.Collection<ColumnDefinition> definitions)` Converts the specified column definitions into column identifiers.
`java.lang.String` `toString()`
`void` `validateCell(Cell cell)`
`ColumnDefinition` `withNewName(ColumnIdentifier newName)`
`ColumnDefinition` `withNewType(AbstractType<?> newType)`

### Methods inherited from class org.apache.cassandra.cql3.ColumnSpecification

`allInSameTable, isReversedType, withAlias`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.cassandra.cql3.selection.Selectable

`addAndGetIndex, testAssignment`

### Field Detail

#### asymmetricColumnDataComparator

    public static final java.util.Comparator<java.lang.Object> asymmetricColumnDataComparator

#### NO_POSITION

    public static final int NO_POSITION

See Also:
  Constant Field Values

#### kind

    public final ColumnDefinition.Kind kind

### Constructor Detail

#### ColumnDefinition

    public ColumnDefinition(CFMetaData cfm,
                            java.nio.ByteBuffer name,
                            AbstractType<?> type,
                            int position,
                            ColumnDefinition.Kind kind)

#### ColumnDefinition

    public ColumnDefinition(java.lang.String ksName,
                            java.lang.String cfName,
                            ColumnIdentifier name,
                            AbstractType<?> type,
                            int position,
                            ColumnDefinition.Kind kind)

### Method Detail

#### partitionKeyDef

    public static ColumnDefinition partitionKeyDef(CFMetaData cfm,
                                                   java.nio.ByteBuffer name,
                                                   AbstractType<?> type,
                                                   int position)

#### partitionKeyDef

    public static ColumnDefinition partitionKeyDef(java.lang.String ksName,
                                                   java.lang.String cfName,
                                                   java.lang.String name,
                                                   AbstractType<?> type,
                                                   int position)

#### clusteringDef

    public static ColumnDefinition clusteringDef(CFMetaData cfm,
                                                 java.nio.ByteBuffer name,
                                                 AbstractType<?> type,
                                                 int position)

#### clusteringDef

    public static ColumnDefinition clusteringDef(java.lang.String ksName,
                                                 java.lang.String cfName,
                                                 java.lang.String name,
                                                 AbstractType<?> type,
                                                 int position)

#### regularDef

    public static ColumnDefinition regularDef(CFMetaData cfm,
                                              java.nio.ByteBuffer name,
                                              AbstractType<?> type)

#### regularDef

    public static ColumnDefinition regularDef(java.lang.String ksName,
                                              java.lang.String cfName,
                                              java.lang.String name,
                                              AbstractType<?> type)

#### staticDef

    public static ColumnDefinition staticDef(CFMetaData cfm,
                                             java.nio.ByteBuffer name,
                                             AbstractType<?> type)

#### copy

    public ColumnDefinition copy()

#### withNewName

    public ColumnDefinition withNewName(ColumnIdentifier newName)

#### withNewType

    public ColumnDefinition withNewType(AbstractType<?> newType)

#### isPartitionKey

    public boolean isPartitionKey()

#### isClusteringColumn

    public boolean isClusteringColumn()

#### isStatic

    public boolean isStatic()

#### isRegular

    public boolean isRegular()

#### clusteringOrder

    public ColumnDefinition.ClusteringOrder clusteringOrder()

#### position

    public int position()

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `ColumnSpecification`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `ColumnSpecification`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `ColumnSpecification`

#### debugString

    public java.lang.String debugString()

#### isPrimaryKeyColumn

    public boolean isPrimaryKeyColumn()

#### isPartOfCellName

    public boolean isPartOfCellName(boolean isCQL3Table,
                                    boolean isSuper)

Whether the name of this definition is serialized in the cell nane, i.e. whether it's not just a non-stored CQL metadata.

#### toIdentifiers

    public static java.util.Collection<ColumnIdentifier> toIdentifiers(java.util.Collection<ColumnDefinition> definitions)

Converts the specified column definitions into column identifiers.

Parameters:
  `definitions` - the column definitions to convert.
Returns:
  the column identifiers corresponding to the specified definitions

#### compareTo

    public int compareTo(ColumnDefinition other)

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

#### cellPathComparator

    public java.util.Comparator<CellPath> cellPathComparator()

#### asymmetricCellPathComparator

    public java.util.Comparator<java.lang.Object> asymmetricCellPathComparator()

#### cellComparator

    public java.util.Comparator<? super Cell> cellComparator()

#### isComplex

    public boolean isComplex()

#### isSimple

    public boolean isSimple()

#### cellPathSerializer

    public CellPath.Serializer cellPathSerializer()

#### validateCell

    public void validateCell(Cell cell)

#### toCQLString

    public static java.lang.String toCQLString(java.lang.Iterable<ColumnDefinition> defs)

#### toCQLString

    public static java.lang.String toCQLString(java.util.Iterator<ColumnDefinition> defs)

#### cellValueType

    public AbstractType<?> cellValueType()

The type of the cell values for cell belonging to this column. This is the same than the column type, except for non-frozen collections where it's the 'valueComparator' of the collection. This method should not be used to get value type of non-frozon UDT.

#### isCounterColumn

    public boolean isCounterColumn()

#### newSelectorFactory

    public Selector.Factory newSelectorFactory(CFMetaData cfm,
                                               AbstractType<?> expectedType,
                                               java.util.List<ColumnDefinition> defs,
                                               VariableSpecifications boundNames)
                                        throws InvalidRequestException

Specified by:
  `newSelectorFactory` in interface `Selectable`
Throws:
  `InvalidRequestException`

#### getExactTypeIfKnown

    public AbstractType<?> getExactTypeIfKnown(java.lang.String keyspace)

Description copied from interface: `Selectable`
The type of the `Selectable` if it can be infered.

Specified by:
  `getExactTypeIfKnown` in interface `Selectable`
Parameters:
  `keyspace` - the keyspace on which the statement for which this is a `Selectable` is on.
Returns:
  the type of this `Selectable` if inferrable, or `null` otherwise (for instance, the type isn't inferable for a bind marker. Even for literals, the exact type is not inferrable since they are valid for many different types and so this will return `null` too).