org.ujac.util.table
Class DataRow

java.lang.Object
  extended by org.ujac.util.table.BaseRow
      extended by org.ujac.util.table.DataRow
All Implemented Interfaces:
Serializable, Row, TableConstants, UjacTypes
Direct Known Subclasses:
GroupRow

public class DataRow
extends BaseRow
implements TableConstants, Row

Name: Row
Description: A class holding row data.

Author:
lauerc
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ujac.util.table.BaseRow
rowData, table
 
Fields inherited from interface org.ujac.util.table.TableConstants
DEFAULT_DATE_FORMAT, DEFAULT_DOUBLE_FORMAT, DEFAULT_INTEGER_FORMAT, DEFAULT_TIME_FORMAT, DEFAULT_TIMESTAMP_FORMAT, ROW_TYPE_FOOTER, ROW_TYPE_GROUP, ROW_TYPE_GROUP_TITLE, ROW_TYPE_HEADER, ROW_TYPE_NORMAL
 
Fields inherited from interface org.ujac.util.UjacTypes
TYPE_BOOLEAN, TYPE_DATE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_LONG, TYPE_NAME_BOOLEAN, TYPE_NAME_DATE, TYPE_NAME_DOUBLE, TYPE_NAME_FLOAT, TYPE_NAME_INT, TYPE_NAME_LONG, TYPE_NAME_OBJECT, TYPE_NAME_SHORT, TYPE_NAME_STRING, TYPE_NAME_TABLE, TYPE_NAME_TIME, TYPE_NAME_TIMESTAMP, TYPE_OBJECT, TYPE_SHORT, TYPE_STRING, TYPE_TABLE, TYPE_TIME, TYPE_TIMESTAMP
 
Constructor Summary
protected DataRow(Table table, int rowIdx)
          Constructs a DataRow instance with specific arguments.
  DataRow(Table table, int rowIdx, Row srcRow)
          Constructs a DataRow instance with specific attributes.
 
Method Summary
protected  void expandRow()
          Expands the length of the row to the number of columns of the table.
 boolean getBoolean(int columnIdx)
          Gets the boolean value from the given row.
 boolean getBoolean(String columnName)
          Gets the boolean value from the given row.
 Date getDate(int columnIdx)
          Gets the Date value from the given row.
 Date getDate(String columnName)
          Gets the Date value from the given row.
 double getDouble(int columnIdx)
          Gets the double value from the given row.
 double getDouble(String columnName)
          Gets the double value from the given row.
 float getFloat(int columnIdx)
          Gets the float value from the given row.
 float getFloat(String columnName)
          Gets the float value from the given row.
 int getIndex()
          Gets the colum index.
 int getInt(int columnIdx)
          Gets the integer value from the given row.
 int getInt(String columnName)
          Gets the int value from the given row.
 long getLong(int columnIdx)
          Gets the long value from the given row.
 long getLong(String columnName)
          Gets the long value from the given row.
 Object getObject(int columnIdx)
          Gets the Object value from the given row.
 Object getObject(String columnName)
          Gets the Object value from the given row.
 String getString(int columnIdx)
          Gets the String value from the given row.
 String getString(String columnName)
          Gets the String value from the given row.
 Table getTable()
          Gets the table the row is member of.
 Date getTime(int columnIdx)
          Gets the Time value from the given row.
 Date getTime(String columnName)
          Gets the Time value from the given row.
 Date getTimestamp(int columnIdx)
          Gets the Timestamp value from the given row.
 Date getTimestamp(String columnName)
          Gets the Timestamp value from the given row.
 String getType()
          Gets the row type.
protected  void readData(ObjectInputStream s)
          Reads the object's data from the given stream.
protected  void removeColumn(int columnIdx)
          Removes the given column from the row data.
 void setBoolean(int columnIdx, boolean value)
          Sets the boolean value at the given row.
 void setBoolean(String columnName, boolean value)
          Sets the boolean value at the given row.
 void setDate(int columnIdx, Date value)
          Sets the Date value at the given row.
 void setDate(String columnName, Date value)
          Sets the Date value at the given row.
 void setDouble(int columnIdx, double value)
          Sets the double value at the given row.
 void setDouble(String columnName, double value)
          Sets the double value at the given row.
 void setFloat(int columnIdx, float value)
          Sets the float value at the given row.
 void setFloat(String columnName, float value)
          Sets the float value at the given row.
protected  void setIndex(int index)
          Sets the colum index.
 void setInt(int columnIdx, int value)
          Sets the integer value at the given row.
 void setInt(String columnName, int value)
          Sets the int value at the given row.
 void setLong(int columnIdx, long value)
          Sets the long value at the given row.
 void setLong(String columnName, long value)
          Sets the long value at the given row.
 void setObject(int columnIdx, Object value)
          Sets the Object value at the given row.
 void setObject(String columnName, Object value)
          Sets the Object value at the given row.
 void setString(int columnIdx, String value)
          Sets the String value at the given row.
 void setString(String columnName, String value)
          Sets the String value at the given row.
 void setTime(int columnIdx, Date value)
          Sets the Time value at the given row.
 void setTime(String columnName, Date value)
          Sets the Time value at the given row.
 void setTimestamp(int columnIdx, Date value)
          Sets the Timestamp value at the given row.
 void setTimestamp(String columnName, Date value)
          Sets the Timestamp value at the given row.
 void setType(String type)
          Sets the row type.
protected  void writeData(ObjectOutputStream s)
          Writes the object's data to the given stream.
 
Methods inherited from class org.ujac.util.table.BaseRow
asList, formatValue, formatValue, getAlign, getAlign, getFieldAlignment, getFormat, getFormat, isEndsBlock, isStartNewPage, isStartsBlock, isVisible, isVisible, setAlign, setAlign, setEndsBlock, setFormat, setFormat, setStartNewPage, setStartsBlock, setVisible, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ujac.util.table.Row
asList, formatValue, formatValue, getAlign, getAlign, getFormat, getFormat, isEndsBlock, isStartNewPage, isStartsBlock, isVisible, isVisible, setAlign, setAlign, setEndsBlock, setFormat, setFormat, setStartNewPage, setStartsBlock, setVisible, setVisible
 

Constructor Detail

DataRow

protected DataRow(Table table,
                  int rowIdx)
Constructs a DataRow instance with specific arguments.

Parameters:
table - The table which contains this row.
rowIdx - The index of this row.

DataRow

public DataRow(Table table,
               int rowIdx,
               Row srcRow)
Constructs a DataRow instance with specific attributes.

Parameters:
table - The row's table.
rowIdx - The index of this row.
srcRow - the row to copy.
Method Detail

getType

public String getType()
Gets the row type.

Specified by:
getType in interface Row
Returns:
The row type.

setType

public void setType(String type)
Sets the row type.

Parameters:
type - The row type to set.

getTable

public Table getTable()
Gets the table the row is member of.

Specified by:
getTable in interface Row
Overrides:
getTable in class BaseRow
Returns:
The table that contains this row.

getIndex

public int getIndex()
Gets the colum index.

Specified by:
getIndex in interface Row
Returns:
The column index.

setIndex

protected void setIndex(int index)
Sets the colum index.

Parameters:
index - The new column index.

expandRow

protected void expandRow()
Expands the length of the row to the number of columns of the table.

Overrides:
expandRow in class BaseRow

removeColumn

protected void removeColumn(int columnIdx)
                     throws ColumnNotDefinedException
Removes the given column from the row data.

Parameters:
columnIdx - The index of the column to remove.
Throws:
ColumnNotDefinedException - In case the column to remove does not exist.

getString

public String getString(String columnName)
                 throws ColumnNotDefinedException,
                        TypeMismatchException
Gets the String value from the given row.

Specified by:
getString in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getString

public String getString(int columnIdx)
                 throws ColumnNotDefinedException,
                        TypeMismatchException
Gets the String value from the given row.

Specified by:
getString in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setString

public void setString(String columnName,
                      String value)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Sets the String value at the given row.

Specified by:
setString in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setString

public void setString(int columnIdx,
                      String value)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Sets the String value at the given row.

Specified by:
setString in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getInt

public int getInt(String columnName)
           throws ColumnNotDefinedException,
                  TypeMismatchException
Gets the int value from the given row.

Specified by:
getInt in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getInt

public int getInt(int columnIdx)
           throws ColumnNotDefinedException,
                  TypeMismatchException
Gets the integer value from the given row.

Specified by:
getInt in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setInt

public void setInt(String columnName,
                   int value)
            throws ColumnNotDefinedException,
                   TypeMismatchException
Sets the int value at the given row.

Specified by:
setInt in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setInt

public void setInt(int columnIdx,
                   int value)
            throws ColumnNotDefinedException,
                   TypeMismatchException
Sets the integer value at the given row.

Specified by:
setInt in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getLong

public long getLong(String columnName)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Gets the long value from the given row.

Specified by:
getLong in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getLong

public long getLong(int columnIdx)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Gets the long value from the given row.

Specified by:
getLong in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setLong

public void setLong(String columnName,
                    long value)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Sets the long value at the given row.

Specified by:
setLong in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setLong

public void setLong(int columnIdx,
                    long value)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Sets the long value at the given row.

Specified by:
setLong in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getFloat

public float getFloat(String columnName)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Gets the float value from the given row.

Specified by:
getFloat in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getFloat

public float getFloat(int columnIdx)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Gets the float value from the given row.

Specified by:
getFloat in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setFloat

public void setFloat(String columnName,
                     float value)
              throws ColumnNotDefinedException,
                     TypeMismatchException
Sets the float value at the given row.

Specified by:
setFloat in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setFloat

public void setFloat(int columnIdx,
                     float value)
              throws ColumnNotDefinedException,
                     TypeMismatchException
Sets the float value at the given row.

Specified by:
setFloat in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getDouble

public double getDouble(String columnName)
                 throws ColumnNotDefinedException,
                        TypeMismatchException
Gets the double value from the given row.

Specified by:
getDouble in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getDouble

public double getDouble(int columnIdx)
                 throws ColumnNotDefinedException,
                        TypeMismatchException
Gets the double value from the given row.

Specified by:
getDouble in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setDouble

public void setDouble(String columnName,
                      double value)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Sets the double value at the given row.

Specified by:
setDouble in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setDouble

public void setDouble(int columnIdx,
                      double value)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Sets the double value at the given row.

Specified by:
setDouble in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getBoolean

public boolean getBoolean(String columnName)
                   throws ColumnNotDefinedException,
                          TypeMismatchException
Gets the boolean value from the given row.

Specified by:
getBoolean in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getBoolean

public boolean getBoolean(int columnIdx)
                   throws ColumnNotDefinedException,
                          TypeMismatchException
Gets the boolean value from the given row.

Specified by:
getBoolean in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setBoolean

public void setBoolean(String columnName,
                       boolean value)
                throws ColumnNotDefinedException,
                       TypeMismatchException
Sets the boolean value at the given row.

Specified by:
setBoolean in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setBoolean

public void setBoolean(int columnIdx,
                       boolean value)
                throws ColumnNotDefinedException,
                       TypeMismatchException
Sets the boolean value at the given row.

Specified by:
setBoolean in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getDate

public Date getDate(String columnName)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Gets the Date value from the given row.

Specified by:
getDate in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getDate

public Date getDate(int columnIdx)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Gets the Date value from the given row.

Specified by:
getDate in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setDate

public void setDate(String columnName,
                    Date value)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Sets the Date value at the given row.

Specified by:
setDate in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setDate

public void setDate(int columnIdx,
                    Date value)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Sets the Date value at the given row.

Specified by:
setDate in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getTime

public Date getTime(String columnName)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Gets the Time value from the given row.

Specified by:
getTime in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getTime

public Date getTime(int columnIdx)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Gets the Time value from the given row.

Specified by:
getTime in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setTime

public void setTime(String columnName,
                    Date value)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Sets the Time value at the given row.

Specified by:
setTime in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setTime

public void setTime(int columnIdx,
                    Date value)
             throws ColumnNotDefinedException,
                    TypeMismatchException
Sets the Time value at the given row.

Specified by:
setTime in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getTimestamp

public Date getTimestamp(String columnName)
                  throws ColumnNotDefinedException,
                         TypeMismatchException
Gets the Timestamp value from the given row.

Specified by:
getTimestamp in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getTimestamp

public Date getTimestamp(int columnIdx)
                  throws ColumnNotDefinedException,
                         TypeMismatchException
Gets the Timestamp value from the given row.

Specified by:
getTimestamp in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setTimestamp

public void setTimestamp(String columnName,
                         Date value)
                  throws ColumnNotDefinedException,
                         TypeMismatchException
Sets the Timestamp value at the given row.

Specified by:
setTimestamp in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setTimestamp

public void setTimestamp(int columnIdx,
                         Date value)
                  throws ColumnNotDefinedException,
                         TypeMismatchException
Sets the Timestamp value at the given row.

Specified by:
setTimestamp in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

getObject

public Object getObject(String columnName)
                 throws ColumnNotDefinedException
Gets the Object value from the given row.

Specified by:
getObject in interface Row
Parameters:
columnName - The name of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.

getObject

public Object getObject(int columnIdx)
                 throws ColumnNotDefinedException
Gets the Object value from the given row.

Specified by:
getObject in interface Row
Parameters:
columnIdx - The index of the desired column.
Returns:
The detected value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.

setObject

public void setObject(String columnName,
                      Object value)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Sets the Object value at the given row.

Specified by:
setObject in interface Row
Parameters:
columnName - The name of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

setObject

public void setObject(int columnIdx,
                      Object value)
               throws ColumnNotDefinedException,
                      TypeMismatchException
Sets the Object value at the given row.

Specified by:
setObject in interface Row
Parameters:
columnIdx - The index of the desired column.
value - The new value.
Throws:
ColumnNotDefinedException - In case the requested column does not exist.
TypeMismatchException - In case the data conversion failed.

writeData

protected void writeData(ObjectOutputStream s)
                  throws IOException
Writes the object's data to the given stream.

Overrides:
writeData in class BaseRow
Parameters:
s - The stream to write to
Throws:
IOException - In case the data output failed.

readData

protected void readData(ObjectInputStream s)
                 throws IOException,
                        ClassNotFoundException
Reads the object's data from the given stream.

Overrides:
readData in class BaseRow
Parameters:
s - The stream to read from.
Throws:
IOException - In case the data reading failed.
ClassNotFoundException - In case the class to deserialize could not be found


Copyright © 2003-2004 UJAC.org. All Rights Reserved.