Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *      Copyright (C) 2012 DataStax Inc.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  *   Unless required by applicable law or agreed to in writing, software
  *   distributed under the License is distributed on an "AS IS" BASIS,
  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *   See the License for the specific language governing permissions and
  *   limitations under the License.
  */
 package com.datastax.driver.core;
 
 import java.util.*;
 
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.

 
 public interface Row {

    
Returns the columns contained in this Row.

Returns:
the columns contained in this Row.
 
     public ColumnDefinitions getColumnDefinitions();

    
Returns whether the ith value of this row is NULL.

Parameters:
i the index (0 <= i < size()) of the column to check.
Returns:
whether the ith value of this row is NULL.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
 
     public boolean isNull(int i);

    
Returns whether the value for column name in this row is NULL.

Parameters:
name the name of the column to check.
Returns:
whether the value of column name is NULL.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
 
     public boolean isNull(String name);

    
Returns the ith value of this row as a boolean.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the boolean value of the ith column in this row. If the value is NULL, false is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type BOOLEAN.
 
     public boolean getBool(int i);

    
Returns the value of column name as a boolean.

Parameters:
name the name of the column to retrieve.
Returns:
the boolean value of column name. If the value is NULL, false is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type BOOLEAN.
 
     public boolean getBool(String name);

    
Returns the ith value of this row as an integer.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as an integer. If the value is NULL, 0 is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type INT.
 
     public int getInt(int i);

    
Returns the value of column name as an integer.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as an integer. If the value is NULL, 0 is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type INT.
    public int getInt(String name);

    
Returns the ith value of this row as a long.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a long. If the value is NULL, 0L is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type BIGINT or COUNTER.
    public long getLong(int i);

    
Returns the value of column name as a long.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a long. If the value is NULL, 0L is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type BIGINT or COUNTER.
    public long getLong(String name);

    
Returns the ith value of this row as a date.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a data. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type TIMESTAMP.
    public Date getDate(int i);

    
Returns the value of column name as a date.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a date. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type TIMESTAMP.
    public Date getDate(String name);

    
Returns the ith value of this row as a float.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a float. If the value is NULL, 0.0f is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type FLOAT.
    public float getFloat(int i);

    
Returns the value of column name as a float.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a float. If the value is NULL, 0.0f is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type FLOAT.
    public float getFloat(String name);

    
Returns the ith value of this row as a double.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a double. If the value is NULL, 0.0 is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type DOUBLE.
    public double getDouble(int i);

    
Returns the value of column name as a double.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a double. If the value is NULL, 0.0 is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type DOUBLE.
    public double getDouble(String name);

    
Returns the ith 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.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a ByteBuffer. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
    public ByteBuffer getBytesUnsafe(int i);

    
Returns the value of column 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.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a ByteBuffer. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
    public ByteBuffer getBytesUnsafe(String name);

    
Returns the ith 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.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a byte array. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i type is not of type BLOB.
    public ByteBuffer getBytes(int i);

    
Returns the value of column 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(java.lang.String) instead.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a byte array. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column i type is not of type BLOB.
    public ByteBuffer getBytes(String name);

    
Returns the ith value of this row as a string.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a string. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i type is none of: VARCHAR, TEXT or ASCII.
    public String getString(int i);

    
Returns the value of column name as a string.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a string. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name type is none of: VARCHAR, TEXT or ASCII.
    public String getString(String name);

    
Returns the ith value of this row as a variable length integer.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a variable length integer. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type VARINT.
    public BigInteger getVarint(int i);

    
Returns the value of column name as a variable length integer.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a variable length integer. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type VARINT.
    public BigInteger getVarint(String name);

    
Returns the ith value of this row as a variable length decimal.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a variable length decimal. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type DECIMAL.
    public BigDecimal getDecimal(int i);

    
Returns the value of column name as a variable length decimal.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a variable length decimal. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type DECIMAL.
    public BigDecimal getDecimal(String name);

    
Returns the ith value of this row as a UUID.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as a UUID. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type UUID or TIMEUUID.
    public UUID getUUID(int i);

    
Returns the value of column name as a UUID.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as a UUID. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type UUID or TIMEUUID.
    public UUID getUUID(String name);

    
Returns the ith value of this row as an InetAddress.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
Returns:
the value of the ith column in this row as an InetAddress. If the value is NULL, null is returned.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not of type INET.
    public InetAddress getInet(int i);

    
Returns the value of column name as an InetAddress.

Parameters:
name the name of the column to retrieve.
Returns:
the value of column name as an InetAddress. If the value is NULL, null is returned.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not of type INET.
    public InetAddress getInet(String name);

    
Returns the ith value of this row as a list.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
elementsClass the class for the elements of the list to retrieve.
Returns:
the value of the ith 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). The returned list is immutable.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not a list or if its elements are not of class elementsClass.
    public <T> List<T> getList(int iClass<T> elementsClass);

    
Returns the value of column name as a list.

Parameters:
name the name of the column to retrieve.
elementsClass the class for the elements of the list to retrieve.
Returns:
the value of the ith 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). The returned list is immutable.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not a list or if its elements are not of class elementsClass.
    public <T> List<T> getList(String nameClass<T> elementsClass);

    
Returns the ith value of this row as a set.

Parameters:
i the index (0 <= i < size()) of the column to retrieve.
elementsClass the class for the elements of the set to retrieve.
Returns:
the value of the ith 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). The returned set is immutable.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.InvalidTypeException if column i is not a set or if its elements are not of class elementsClass.
    public <T> Set<T> getSet(int iClass<T> elementsClass);

    
Returns the value of column name as a set.

Parameters:
name the name of the column to retrieve.
elementsClass the class for the elements of the set to retrieve.
Returns:
the value of the ith 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). The returned set is immutable.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.InvalidTypeException if column name is not a set or if its elements are not of class elementsClass.
    public <T> Set<T> getSet(String nameClass<T> elementsClass);

    
Returns the ith value of this row as a map.

Parameters:
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.
Returns:
the value of the ith 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). The returned map is immutable.
Throws:
java.lang.IndexOutOfBoundsException if i < 0 || i >= this.columns().size().
com.datastax.driver.core.exceptions.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(int iClass<K> keysClassClass<V> valuesClass);

    
Returns the value of column name as a map.

Parameters:
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.
Returns:
the value of the ith 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). The returned map is immutable.
Throws:
java.lang.IllegalArgumentException if name is not part of the ResultSet this row is part of, i.e. if !this.columns().names().contains(name).
com.datastax.driver.core.exceptions.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 <K, V> Map<K, V> getMap(String nameClass<K> keysClassClass<V> valuesClass);
New to GrepCode? Check out our FAQ X