public method O2GOfferTableRow.getCell

Brief

Gets a cell of the table.

Declaration
Java
Object  getCell (int iColumn)

Parameters
iColumn

The index of the column. The index should be between 0 and getColumns().size() - 1.

Returns

Returns the cell value that can be of different types. To determine a type, it is necessary to get a column by using the O2GGenericTableResponseReader.getColumns and the O2GTableColumnCollection.get methods. The index passed to the latter method should be the same as the column parameter. The type of value is defined by using the O2GTableColumn.getType method. The IO2GTableColumn::O2GTableColumnType enumerator returned by the above method contains the returned value type. A client application can cast object data to the returned type or can use abstract object.

Column types and cast operations:

Column type

getCell value

O2GTableColumnType.INTEGER

The method returns the 32-bit Integer class.
Cast operation: Integer value = (Integer)reader.getCell(columnIndex);

O2GTableColumnType.DOUBLE

The method returns the Double class.
Cast operation: Double value = (double)reader.getCell(column);

O2GTableColumn.BOOLEAN

The method returns the Boolean class.
Cast operation: Boolean value = (Boolean)reader.getCell(column);

O2GTableColumn.DATE

The method returns the calendar.
Cast operation: Calendar value = (Calendar)reader.getCell(column);

O2GTableColumnType.STRING

The method returns a string data value.
Cast operation: String value = (String)reader.getCell(column);

Details

The method is used to work with an abstract table. The method provides common access to a row value independently of a row type (a table type).

Print Generic Table [hide]

private void printGenericTableInterface(O2GGenericTableResponseReader genericReader) {
    System.out.println("Generic table");
    O2GTableColumnCollection columns = genericReader.getColumns();
 
    for (int i = 0; i < genericReader.size(); i++) {
        int iCount = columns.size();
        O2GRow row = genericReader.getGenericRow(i)
        for (int j = 0; j < iCount; j++) {
            Object value = row.getCell(j);
            O2GTableColumn column = columns.get(j);
            if (column.getType() == O2GTableColumnType.DATE) {
                value = ((Calendar)value).getTime();
            }
        String sColumn = MessageFormat.format("{0} {1} {2}", column.getId(), value, column.getType());
        System.out.println(sColumn);
        }
    }
}

Declared in O2GRow

back