Interface Row

    • Method Detail

      • getColumnDefinitions

        ColumnDefinitions getColumnDefinitions()
        Returns the columns contained in this Row.
        Returns:
        the columns contained in this Row.
      • getToken

        Token getToken​(int i)
        Returns the ith value of this row as a Token.

        getPartitionKeyToken() should generally be preferred to this method (unless the token column is aliased).

        Parameters:
        i - the index (0 <= i < size()) of the column to retrieve.
        Returns:
        the value of the ith column in this row as an Token.
        Throws:
        IndexOutOfBoundsException - if i < 0 || i >= this.columns().size().
        InvalidTypeException - if column i is not of the type of token values for this cluster (this depends on the configured partitioner).
      • getToken

        Token getToken​(String name)
        Returns the value of column name as a Token.

        getPartitionKeyToken() should generally be preferred to this method (unless the token column is aliased).

        Parameters:
        name - the name of the column to retrieve.
        Returns:
        the value of column name as a Token.
        Throws:
        IllegalArgumentException - if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
        InvalidTypeException - if column name is not of the type of token values for this cluster (this depends on the configured partitioner).
      • getPartitionKeyToken

        Token getPartitionKeyToken()
        Returns the value of the first column containing a Token.

        This method is a shorthand for queries returning a single token in an unaliased column. It will look for the first name matching token(...):

        
         ResultSet rs = session.execute("SELECT token(k) FROM my_table WHERE k = 1");
         Token token = rs.one().getPartitionKeyToken(); // retrieves token(k)
         
        If that doesn't work for you (for example, if you're using an alias), use getToken(int) or getToken(String).
        Returns:
        the value of column name as a Token.
        Throws:
        IllegalStateException - if no column named token(...) exists in this ResultSet.
        InvalidTypeException - if the first column named token(...) is not of the type of token values for this cluster (this depends on the configured partitioner).