xxl.relational
Class AbstractTuple

java.lang.Object
  |
  +--xxl.relational.AbstractTuple
Direct Known Subclasses:
ArrayTuple, ListTuple

public abstract class AbstractTuple
extends java.lang.Object
implements Tuple

This class is a skeleton-implementation for Tuple.

The constructor of this class calls the getObject method for each column from the given input-ResultSet (which must not be empty). and adds the returned Objects to a List.

Two column values x and y are equal, if they are both null or they are both not null and x.equals(y) holds. Tuples are equal, if they have the same number of columns and they are equal on each column value.

The getXXX methods retrieve the values with the given index from the internal List, and return the casted result.


Field Summary
protected  int hashCode
           
protected  java.util.List list
           
protected  java.sql.ResultSet resultSet
           
 
Constructor Summary
AbstractTuple(java.sql.ResultSet resultSet, java.util.List list)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
protected  int findColumn(java.lang.String columnName)
           
 boolean getBoolean(int columnIndex)
           
 boolean getBoolean(java.lang.String columnName)
           
 byte getByte(int columnIndex)
           
 byte getByte(java.lang.String columnName)
           
 java.sql.Date getDate(int columnIndex)
           
 java.sql.Date getDate(java.lang.String columnName)
           
 double getDouble(int columnIndex)
           
 double getDouble(java.lang.String columnName)
           
 float getFloat(int columnIndex)
           
 float getFloat(java.lang.String columnName)
           
 int getInt(int columnIndex)
           
 int getInt(java.lang.String columnName)
           
 long getLong(int columnIndex)
           
 long getLong(java.lang.String columnName)
           
 java.sql.ResultSetMetaData getMetaData()
           
 java.lang.Object getObject(int columnIndex)
           
 java.lang.Object getObject(java.lang.String columnName)
           
protected static Function getObjectFunction(int columnIndex)
           
 short getShort(int columnIndex)
           
 short getShort(java.lang.String columnName)
           
 java.lang.String getString(int columnIndex)
           
 java.lang.String getString(java.lang.String columnName)
           
 java.sql.Time getTime(int columnIndex)
           
 java.sql.Time getTime(java.lang.String columnName)
           
 java.sql.Timestamp getTimestamp(int columnIndex)
           
 java.sql.Timestamp getTimestamp(java.lang.String columnName)
           
static java.util.Comparator getTupleComparator(int[] columns, boolean[] ascending)
           
 int hashCode()
           
 boolean isNull(int columnIndex)
           
 boolean isNull(java.lang.String columnName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultSet

protected java.sql.ResultSet resultSet

list

protected java.util.List list

hashCode

protected int hashCode
Constructor Detail

AbstractTuple

public AbstractTuple(java.sql.ResultSet resultSet,
                     java.util.List list)
Method Detail

getTupleComparator

public static java.util.Comparator getTupleComparator(int[] columns,
                                                      boolean[] ascending)

getObjectFunction

protected static Function getObjectFunction(int columnIndex)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getObject

public java.lang.Object getObject(int columnIndex)
Specified by:
getObject in interface Tuple

findColumn

protected int findColumn(java.lang.String columnName)

getObject

public java.lang.Object getObject(java.lang.String columnName)
Specified by:
getObject in interface Tuple

isNull

public boolean isNull(int columnIndex)
Specified by:
isNull in interface Tuple

isNull

public boolean isNull(java.lang.String columnName)
Specified by:
isNull in interface Tuple

getMetaData

public java.sql.ResultSetMetaData getMetaData()
Specified by:
getMetaData in interface Tuple

getBoolean

public boolean getBoolean(int columnIndex)
Specified by:
getBoolean in interface Tuple

getBoolean

public boolean getBoolean(java.lang.String columnName)
Specified by:
getBoolean in interface Tuple

getByte

public byte getByte(int columnIndex)
Specified by:
getByte in interface Tuple

getByte

public byte getByte(java.lang.String columnName)
Specified by:
getByte in interface Tuple

getDate

public java.sql.Date getDate(int columnIndex)
Specified by:
getDate in interface Tuple

getDate

public java.sql.Date getDate(java.lang.String columnName)
Specified by:
getDate in interface Tuple

getDouble

public double getDouble(int columnIndex)
Specified by:
getDouble in interface Tuple

getDouble

public double getDouble(java.lang.String columnName)
Specified by:
getDouble in interface Tuple

getFloat

public float getFloat(int columnIndex)
Specified by:
getFloat in interface Tuple

getFloat

public float getFloat(java.lang.String columnName)
Specified by:
getFloat in interface Tuple

getInt

public int getInt(int columnIndex)
Specified by:
getInt in interface Tuple

getInt

public int getInt(java.lang.String columnName)
Specified by:
getInt in interface Tuple

getLong

public long getLong(int columnIndex)
Specified by:
getLong in interface Tuple

getLong

public long getLong(java.lang.String columnName)
Specified by:
getLong in interface Tuple

getShort

public short getShort(int columnIndex)
Specified by:
getShort in interface Tuple

getShort

public short getShort(java.lang.String columnName)
Specified by:
getShort in interface Tuple

getString

public java.lang.String getString(int columnIndex)
Specified by:
getString in interface Tuple

getString

public java.lang.String getString(java.lang.String columnName)
Specified by:
getString in interface Tuple

getTime

public java.sql.Time getTime(int columnIndex)
Specified by:
getTime in interface Tuple

getTime

public java.sql.Time getTime(java.lang.String columnName)
Specified by:
getTime in interface Tuple

getTimestamp

public java.sql.Timestamp getTimestamp(int columnIndex)
Specified by:
getTimestamp in interface Tuple

getTimestamp

public java.sql.Timestamp getTimestamp(java.lang.String columnName)
Specified by:
getTimestamp in interface Tuple