public method IO2GEachRowListener.onEachRow
Brief
Processes iteration through rows of a table.
Declaration | ||||
|
Parameters | |
rowID |
The identifier of a row. The parameter has the value of the row identifier for a specific trading table. For example, for the Accounts table, it has the value of the AccountID field. The complete list of the identifiers is shown below. |
rowData |
The object representing a row of a table. In order to process the parameter, you need to know what table it belongs to. It can be accomplished by calling
the |
Details
Table name |
|
Cast |
Casting syntax |
AccountID |
|
||
OfferID |
|
||
TradeID |
|
||
TradeID |
|
||
OrderID |
|
||
MsgID |
|
||
OfferID |
|
To get notifications about iteration through each row of a specific table, an instance of the class implementing
the IO2GEachRowListener
interface must be passed to the O2GTable
.forEachRow
method as an argument.
For example, if you want to get notifications about iteration through the rows of the Trades table, write the following line:
tradesTable.forEachRow(forEachListener);
Note: The returned row contains the current values of fields. The values are not automatically updated. To monitor changes, use IO2GTableListener.onChanged
.
The row interface is thread-safe. One can use the returned row in different threads without synchronization.
For the method implementation details, see the example below.
Example
Process iteration through the rows of the Trades table [hide]
// Create session which uses table manager mSession = O2GTransport.createSession(); mSession.useTableManager(O2GTableManagerMode.YES, null); //... // After the login, get instances of the table manager and Trades table O2GTableManager tableManager = mSession.getTableManager(); O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTableType.TRADES); // ... // Iterate through the rows of the Trades table EachRowListener eachRowListener = new EachRowListener(); tradesTable.forEachRow(eachRowListener); // Implementation of IO2GEachRowListener interface public method onEachRow public void onEachRow(String rowID, O2GRow rowData) { O2GTradeTableRow trade = (O2GTradeTableRow)(rowData); System.out.println("Iterating through the row " + rowID); System.out.println("TradeID: " + trade.getTradeID() + " Close = " + trade.getClose()); }
Declared in IO2GEachRowListener