java.lang.Object
org.springframework.data.cassandra.core.query.Columns
All Implemented Interfaces:
Iterable<ColumnName>

public class Columns extends Object implements Iterable<ColumnName>
Value object to abstract column names involved in a CQL query. Columns can be constructed from an array of names and included using a Columns.Selector.
Since:
2.0
Author:
Mark Paluch
See Also:
  • Method Details

    • empty

      public static Columns empty()
      Create an empty Columns instance without any columns.
      Returns:
      an empty Columns instance.
    • from

      public static Columns from(String... columnNames)
      Create a Columns given columnNames. Individual column names can be either quoted or unquoted.
      Parameters:
      columnNames - must not be null.
      Returns:
      the Columns object for columnNames.
    • from

      public static Columns from(com.datastax.oss.driver.api.core.CqlIdentifier... columnNames)
      Create a Columns given columnNames.
      Parameters:
      columnNames - must not be null.
      Returns:
      the Columns object for columnNames.
    • include

      public Columns include(String columnName)
      Include column columnName to the selection. Column inclusion overrides an existing selection for the column name.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Columns object containing all column definitions and the included columnName.
    • include

      public Columns include(com.datastax.oss.driver.api.core.CqlIdentifier columnName)
      Include column columnName to the selection. Column inclusion overrides an existing selection for the column name.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Columns object containing all column definitions and the included columnName.
    • ttl

      public Columns ttl(String columnName)
      Include column columnName as TTL value in the selection. This column selection overrides an existing selection for the column name.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Columns object containing all column definitions and the TTL for columnName.
    • ttl

      public Columns ttl(com.datastax.oss.driver.api.core.CqlIdentifier columnName)
      Include column columnName as TTL value in the selection. This column selection overrides an existing selection for the column name.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Columns object containing all column definitions and the TTL for columnName.
    • select

      public Columns select(String columnName, Columns.Selector selector)
      Include column columnName with Columns.Selector. This column selection overrides an existing selection for the column name.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Columns object containing all column definitions and the selected columnName.
    • select

      public Columns select(com.datastax.oss.driver.api.core.CqlIdentifier columnName, Columns.Selector selector)
      Include column columnName with Columns.Selector. This column selection overrides an existing selection for the column name.
      Parameters:
      columnName - must not be null.
      Returns:
      a new Columns object containing all column definitions and the selected columnName.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if no columns were specified and this Columns object is empty.
    • and

      public Columns and(Columns columns)
      Returns a new Columns consisting of the ColumnNames of the current Columns combined with the given ones. Existing ColumnNames are overwritten if specified within columns.
      Parameters:
      columns - must not be null.
      Returns:
      a new Columns with the merged result of the configured and given Columns.
    • iterator

      public Iterator<ColumnName> iterator()
      Specified by:
      iterator in interface Iterable<ColumnName>
    • getSelector

      public Optional<Columns.Selector> getSelector(ColumnName columnName)
      Parameters:
      columnName - must not be null.
      Returns:
      the Optional Columns.Selector for ColumnName.
    • equals

      public boolean equals(@Nullable Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object