java.lang.Object
org.springframework.data.cassandra.core.query.ColumnName

public abstract class ColumnName extends Object
Value object representing a column name. Column names can be expressed either through CqlIdentifier or a String literal. Using a String literal preserves case and is suitable to reference properties.

Equality and hash code are based on toCql() representation.

Implementing classes must provide either getColumnName() or getCqlIdentifier().

Since:
2.0
Author:
Mark Paluch
See Also:
  • CqlIdentifier
  • Constructor Details

    • ColumnName

      public ColumnName()
  • Method Details

    • from

      public static ColumnName from(com.datastax.oss.driver.api.core.CqlIdentifier cqlIdentifier)
      Create a ColumnName given CqlIdentifier. The resulting instance uses CQL identifier rules to identify column names (quoting, case-sensitivity).
      Parameters:
      cqlIdentifier - must not be null.
      Returns:
      the ColumnName for CqlIdentifier
      See Also:
      • CqlIdentifier
    • from

      public static ColumnName from(String columnName)
      Create a ColumnName given a string columnName. The resulting instance uses String rules to identify column names (case-sensitivity).
      Parameters:
      columnName - must not be null or empty.
      Returns:
      the ColumnName for CqlIdentifier
    • getColumnName

      public abstract Optional<String> getColumnName()
      Returns:
      the optional column name.
    • getCqlIdentifier

      public abstract Optional<com.datastax.oss.driver.api.core.CqlIdentifier> getCqlIdentifier()
      Returns:
      the optional CqlIdentifier.
    • toCql

      public abstract String toCql()
      Represent the column name as CQL.
      Returns:
      CQL representation of the column name.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object