Package com.datastax.driver.core
Interface Row
-
- All Superinterfaces:
GettableByIndexData,GettableByNameData,GettableData
public interface Row extends GettableData
A CQL Row returned in aResultSet.The values of a CQL Row can be retrieved by either index (index starts at zero) or name. When getting them by name, names follow the case insensitivity rules explained in
ColumnDefinitions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ColumnDefinitionsgetColumnDefinitions()Returns the columns contained in this Row.TokengetPartitionKeyToken()Returns the value of the first column containing aToken.TokengetToken(int i)Returns theith value of this row as aToken.TokengetToken(String name)Returns the value of columnnameas aToken.-
Methods inherited from interface com.datastax.driver.core.GettableByIndexData
get, get, get, getBool, getByte, getBytes, getBytesUnsafe, getDate, getDecimal, getDouble, getFloat, getInet, getInt, getList, getList, getLong, getMap, getMap, getObject, getSet, getSet, getShort, getString, getTime, getTimestamp, getTupleValue, getUDTValue, getUUID, getVarint, isNull
-
Methods inherited from interface com.datastax.driver.core.GettableByNameData
get, get, get, getBool, getByte, getBytes, getBytesUnsafe, getDate, getDecimal, getDouble, getFloat, getInet, getInt, getList, getList, getLong, getMap, getMap, getObject, getSet, getSet, getShort, getString, getTime, getTimestamp, getTupleValue, getUDTValue, getUUID, getVarint, isNull
-
-
-
-
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 theith value of this row as aToken.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- ifi < 0 || i >= this.columns().size().InvalidTypeException- if columniis 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 columnnameas aToken.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
nameas a Token. - Throws:
IllegalArgumentException- ifnameis not part of the ResultSet this row is part of, i.e. if!this.columns().names().contains(name).InvalidTypeException- if columnnameis 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 aToken.This method is a shorthand for queries returning a single token in an unaliased column. It will look for the first name matching
token(...):
If that doesn't work for you (for example, if you're using an alias), useResultSet rs = session.execute("SELECT token(k) FROM my_table WHERE k = 1"); Token token = rs.one().getPartitionKeyToken(); // retrieves token(k)getToken(int)orgetToken(String).- Returns:
- the value of column
nameas a Token. - Throws:
IllegalStateException- if no column namedtoken(...)exists in this ResultSet.InvalidTypeException- if the first column namedtoken(...)is not of the type of token values for this cluster (this depends on the configured partitioner).
-
-