|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.datastax.driver.core.Row
public class Row
A CQL Row returned in a ResultSet
.
The values of a CQL Row can be retrieve by either index (index starts at 0)
or name. When setting them by name, names follow the case insensitivity
rules explained in ColumnDefinitions
.
Method Summary | ||
---|---|---|
boolean |
getBool(int i)
Returns the i th value of this row as a boolean. |
|
boolean |
getBool(String name)
Returns the value of column name as a boolean. |
|
ByteBuffer |
getBytes(int i)
Returns the i th value of this row as a byte array. |
|
ByteBuffer |
getBytes(String name)
Returns the value of column name as a byte array. |
|
ByteBuffer |
getBytesUnsafe(int i)
Returns the i th value of this row as a ByteBuffer. |
|
ByteBuffer |
getBytesUnsafe(String name)
Returns the value of column name as a ByteBuffer. |
|
ColumnDefinitions |
getColumnDefinitions()
Returns the columns contained in this Row. |
|
Date |
getDate(int i)
Returns the i th value of this row as a date. |
|
Date |
getDate(String name)
Returns the value of column name as a date. |
|
BigDecimal |
getDecimal(int i)
Returns the i th value of this row as a variable length decimal. |
|
BigDecimal |
getDecimal(String name)
Returns the value of column name as a variable length decimal. |
|
double |
getDouble(int i)
Returns the i th value of this row as a double. |
|
double |
getDouble(String name)
Returns the value of column name as a double. |
|
float |
getFloat(int i)
Returns the i th value of this row as a float. |
|
float |
getFloat(String name)
Returns the value of column name as a float. |
|
InetAddress |
getInet(int i)
Returns the i th value of this row as an InetAddress. |
|
InetAddress |
getInet(String name)
Returns the value of column name as an InetAddress. |
|
int |
getInt(int i)
Returns the i th value of this row as an integer. |
|
int |
getInt(String name)
Returns the value of column name as an integer. |
|
|
getList(int i,
Class<T> elementsClass)
Returns the i th value of this row as a list. |
|
|
getList(String name,
Class<T> elementsClass)
Returns the value of column name as a list. |
|
long |
getLong(int i)
Returns the i th value of this row as a long. |
|
long |
getLong(String name)
Returns the value of column name as a long. |
|
|
getMap(int i,
Class<K> keysClass,
Class<V> valuesClass)
Returns the i th value of this row as a map. |
|
|
getMap(String name,
Class<K> keysClass,
Class<V> valuesClass)
Returns the value of column name as a map. |
|
|
getSet(int i,
Class<T> elementsClass)
Returns the i th value of this row as a set. |
|
|
getSet(String name,
Class<T> elementsClass)
Returns the value of column name as a set. |
|
String |
getString(int i)
Returns the i th value of this row as a string. |
|
String |
getString(String name)
Returns the value of column name as a string. |
|
UUID |
getUUID(int i)
Returns the i th value of this row as a UUID. |
|
UUID |
getUUID(String name)
Returns the value of column name as a UUID. |
|
BigInteger |
getVarint(int i)
Returns the i th value of this row as a variable length integer. |
|
BigInteger |
getVarint(String name)
Returns the value of column name as a variable length integer. |
|
boolean |
isNull(int i)
Returns whether the i th value of this row is NULL. |
|
boolean |
isNull(String name)
Returns whether the value for column name in this row is NULL. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public ColumnDefinitions getColumnDefinitions()
public boolean isNull(int i)
i
th value of this row is NULL.
i
- the index (0 <= i < size()
) of the column to check.
i
th value of this row is NULL.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.public boolean isNull(String name)
name
in this row is NULL.
name
- the name of the column to check.
name
is NULL.
IllegalArgumentException
- if name
is not part of the
ResultSet this row is part of, i.e. if !this.columns().names().contains(name)
.public boolean getBool(int i)
i
th value of this row as a boolean.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row. If the
value is NULL, false
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type BOOLEAN.public boolean getBool(String name)
name
as a boolean.
name
- the name of the column to retrieve.
name
. If the value is NULL,
false
is returned.
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 type BOOLEAN.public int getInt(int i)
i
th value of this row as an integer.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as an integer. If the
value is NULL, 0
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type INT.public int getInt(String name)
name
as an integer.
name
- the name of the column to retrieve.
name
as an integer. If the value is NULL,
0
is returned.
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 type INT.public long getLong(int i)
i
th value of this row as a long.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a long. If the
value is NULL, 0L
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type BIGINT or COUNTER.public long getLong(String name)
name
as a long.
name
- the name of the column to retrieve.
name
as a long. If the value is NULL,
0L
is returned.
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 i
is not of type BIGINT or COUNTER.public Date getDate(int i)
i
th value of this row as a date.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a data. If the
value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type TIMESTAMP.public Date getDate(String name)
name
as a date.
name
- the name of the column to retrieve.
name
as a date. If the value is NULL,
null
is returned.
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 type TIMESTAMP.public float getFloat(int i)
i
th value of this row as a float.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a float. If the
value is NULL, 0.0f
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type FLOAT.public float getFloat(String name)
name
as a float.
name
- the name of the column to retrieve.
name
as a float. If the value is NULL,
0.0f
is returned.
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 type FLOAT.public double getDouble(int i)
i
th value of this row as a double.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a double. If the
value is NULL, 0.0
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type DOUBLE.public double getDouble(String name)
name
as a double.
name
- the name of the column to retrieve.
name
as a double. If the value is NULL,
0.0
is returned.
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 type DOUBLE.public ByteBuffer getBytesUnsafe(int i)
i
th value of this row as a ByteBuffer.
Note: this method always return the bytes composing the value, even if
the column is not of type BLOB. That is, this method never throw an
InvalidTypeException. However, if the type is not BLOB, it is up to the
caller to handle the returned value correctly.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a ByteBuffer. If the
value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.public ByteBuffer getBytesUnsafe(String name)
name
as a ByteBuffer.
Note: this method always return the bytes composing the value, even if
the column is not of type BLOB. That is, this method never throw an
InvalidTypeException. However, if the type is not BLOB, it is up to the
caller to handle the returned value correctly.
name
- the name of the column to retrieve.
name
as a ByteBuffer. If the value is NULL,
null
is returned.
IllegalArgumentException
- if name
is not part of the
ResultSet this row is part of, i.e. if !this.columns().names().contains(name)
.public ByteBuffer getBytes(int i)
i
th value of this row as a byte array.
Note that this method validate that the colum is of type BLOB. If you want to retrieve
the bytes for any type of columns, use getBytesUnsafe(int)
instead.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a byte array. If the
value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
type is not of type BLOB.public ByteBuffer getBytes(String name)
name
as a byte array.
Note that this method validate that the column is of type BLOB. If you want to retrieve
the bytes for any type of columns, use getBytesUnsafe(String)
instead.
name
- the name of the column to retrieve.
name
as a byte array. If the value is NULL,
null
is returned.
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 i
type is not of type BLOB.public String getString(int i)
i
th value of this row as a string.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a string. If the
value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
type is none of:
VARCHAR, TEXT or ASCII.public String getString(String name)
name
as a string.
name
- the name of the column to retrieve.
name
as a string. If the value is NULL,
null
is returned.
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
type is none of:
VARCHAR, TEXT or ASCII.public BigInteger getVarint(int i)
i
th value of this row as a variable length integer.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a variable
length integer. If the value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type VARINT.public BigInteger getVarint(String name)
name
as a variable length integer.
name
- the name of the column to retrieve.
name
as a variable length integer.
If the value is NULL, null
is returned.
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 type VARINT.public BigDecimal getDecimal(int i)
i
th value of this row as a variable length decimal.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a variable
length decimal. If the value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type DECIMAL.public BigDecimal getDecimal(String name)
name
as a variable length decimal.
name
- the name of the column to retrieve.
name
as a variable length decimal.
If the value is NULL, null
is returned.
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 type DECIMAL.public UUID getUUID(int i)
i
th value of this row as a UUID.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as a UUID.
If the value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type UUID
or TIMEUUID.public UUID getUUID(String name)
name
as a UUID.
name
- the name of the column to retrieve.
name
as a UUID.
If the value is NULL, null
is returned.
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 type
UUID or TIMEUUID.public InetAddress getInet(int i)
i
th value of this row as an InetAddress.
i
- the index (0 <= i < size()
) of the column to retrieve.
i
th column in this row as an InetAddress.
If the value is NULL, null
is returned.
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not of type INET.public InetAddress getInet(String name)
name
as an InetAddress.
name
- the name of the column to retrieve.
name
as an InetAddress.
If the value is NULL, null
is returned.
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 type
INET.public <T> List<T> getList(int i, Class<T> elementsClass)
i
th value of this row as a list.
i
- the index (0 <= i < size()
) of the column to retrieve.elementsClass
- the class for the elements of the list to retrieve.
i
th column in this row as a list of
elementsClass
objects. If the value is NULL, an empty list is
returned (note that Cassandra makes no difference between an empty list
and column of type list that is not set).
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not a list or if its
elements are not of class elementsClass
.public <T> List<T> getList(String name, Class<T> elementsClass)
name
as a list.
name
- the name of the column to retrieve.elementsClass
- the class for the elements of the list to retrieve.
i
th column in this row as a list of
elementsClass
objects. If the value is NULL, an empty list is
returned (note that Cassandra makes no difference between an empty list
and column of type list that is not set).
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 a list or if its
elements are not of class elementsClass
.public <T> Set<T> getSet(int i, Class<T> elementsClass)
i
th value of this row as a set.
i
- the index (0 <= i < size()
) of the column to retrieve.elementsClass
- the class for the elements of the set to retrieve.
i
th column in this row as a set of
elementsClass
objects. If the value is NULL, an empty set is
returned (note that Cassandra makes no difference between an empty set
and column of type set that is not set).
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not a set or if its
elements are not of class elementsClass
.public <T> Set<T> getSet(String name, Class<T> elementsClass)
name
as a set.
name
- the name of the column to retrieve.elementsClass
- the class for the elements of the set to retrieve.
i
th column in this row as a set of
elementsClass
objects. If the value is NULL, an empty set is
returned (note that Cassandra makes no difference between an empty set
and column of type set that is not set).
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 a set or if its
elements are not of class elementsClass
.public <K,V> Map<K,V> getMap(int i, Class<K> keysClass, Class<V> valuesClass)
i
th value of this row as a map.
i
- the index (0 <= i < size()
) of the column to retrieve.keysClass
- the class for the keys of the map to retrieve.valuesClass
- the class for the values of the map to retrieve.
i
th column in this row as a map of
keysClass
to valuesClass
objects. If the value is NULL,
an empty map is returned (note that Cassandra makes no difference
between an empty map and column of type map that is not set).
IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.
InvalidTypeException
- if column i
is not a map, if its
keys are not of class keysClass
or if its values are not of
class valuesClass
.public <K,V> Map<K,V> getMap(String name, Class<K> keysClass, Class<V> valuesClass)
name
as a map.
name
- the name of the column to retrieve.keysClass
- the class for the keys of the map to retrieve.valuesClass
- the class for the values of the map to retrieve.
i
th column in this row as a map of
keysClass
to valuesClass
objects. If the value is NULL,
an empty map is returned (note that Cassandra makes no difference
between an empty map and column of type map that is not set).
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 a map, if its
keys are not of class keysClass
or if its values are not of
class valuesClass
.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |