public interface Filler
Parser while processing ASTS buffer.| Modifier and Type | Method and Description |
|---|---|
void |
doneRecordUpdate(Meta.Message source)
Notifies implementation after all field values of the current
record have been processed.
|
void |
doneTableUpdate(Meta.Message source)
Called by the
Parser after all rows of the source
have been parsed. |
int |
getRecordDecimals()
May be called at some moment between
initRecordUpdate(Meta.Message) and
doneRecordUpdate(Meta.Message) by the Parser to retrieve
the scale of the current record which is being updated. |
boolean |
initRecordUpdate(Meta.Message source)
Called for every record after assigning primary key values if any
(see
setKeyValue(Meta.Field, Object) and before
subsequent per-field value assignment (see
setFieldValue(Meta.Field, Object)). |
boolean |
initTableUpdate(Meta.Message source)
Called by
Parser when it is about to start handling records of
the Meta.Message. |
void |
setFieldValue(Meta.Field field,
Object value)
Assigns the parsed value of the field.
|
void |
setKeyValue(Meta.Field field,
Object value)
Notifies implementation of the record primary key values (if any)
before
initRecordUpdate(Meta.Message) is called. |
void |
setRecordDecimals(int decimals)
Called after
initRecordUpdate(Meta.Message) for a new record
only and provides scale information for that record. |
void |
switchOrderbook(Meta.Message source,
Meta.Ticker ticker)
Notifies implementation that a new block of order-book records is
starting.
|
boolean initTableUpdate(Meta.Message source)
Parser when it is about to start handling records of
the Meta.Message.
Implementation is responsible to take appropriate handling depending on Meta.Message.isUpdateable(),
Meta.Message.isClearOnUpdate() and
Meta.Message.isOrderbook() source flags.
Can be considered as some sort of transaction start.
source - structure information of the table being parsed.void doneTableUpdate(Meta.Message source)
Parser after all rows of the source
have been parsed.
Can be considered as some sort of transaction commit.
source - structure information of the table being parsed.boolean initRecordUpdate(Meta.Message source)
setKeyValue(Meta.Field, Object) and before
subsequent per-field value assignment (see
setFieldValue(Meta.Field, Object)).
Implementation is responsible to search it's internal data structures for previous record values based on supplied key values and should prepare that structures for an insert or update operation.
While parsing the same table (between initTableUpdate(com.micex.client.Meta.Message) and doneTableUpdate(com.micex.client.Meta.Message)) the same record (having the same primary keys) can be updated multiple times with different set of field values.
If the Meta.Message has no primary keys (and
setKeyValue(Meta.Field, Object) was never called) or if
Meta.Message is and order-book one then every record should be
treated as newly created (return true).
source - structure information of the table being parsed.true if a new primary key combination is detected meaning
a new fresh record is going to be created; false if record has
been found by primary keys and will be updated.setKeyValue(Meta.Field, Object),
switchOrderbook(Meta.Message, Meta.Ticker),
setFieldValue(Meta.Field, Object)void doneRecordUpdate(Meta.Message source)
Implementation can complete insert or update operation.
Is also a good place to reset collected primary key values.
source - structure information of the table being parsed.int getRecordDecimals()
initRecordUpdate(Meta.Message) and
doneRecordUpdate(Meta.Message) by the Parser to retrieve
the scale of the current record which is being updated.
When the parser is unable to detect scale information from the processed data, it requests outer storage implementation to provide the scale of the record to be able to go on processing values. This can happen when the parser processes table updates which have only primary keys and pricing change information encoded in ASTS buffer (updates of ORDERS/NEGDEALS and similar tables).
Implementation responsibility is to provide proper scale information so that parser could interpret price values correctly.
void setRecordDecimals(int decimals)
initRecordUpdate(Meta.Message) for a new record
only and provides scale information for that record.
Implementation is responsible to store scale information among the rest
of the record data and should be able to return it back when
Parser needs for.
The method will not be called for the Meta.Message containing no
scale-sensitive fields (prices).
decimals - scale information for the current record.void setKeyValue(Meta.Field field, Object value)
initRecordUpdate(Meta.Message) is called.
Implementation should collect these values and use them later during initRecordUpdate(Meta.Message) to detect insert or update operation.
The collected values should be reset during
doneRecordUpdate(Meta.Message).
Note: There can be more than one primary key field per table.
Note: Order-book and similar tables (those having
Meta.Message.isOrderbook()==true) do not have primary
keys so this method will not be called. Instead such tables have special
handling through switchOrderbook(Meta.Message, Meta.Ticker).
field - structure information of the field.value - decoded value, see
setFieldValue(Meta.Field, Object) for explanation of possible
value instances.setFieldValue(Meta.Field, Object)void setFieldValue(Meta.Field field, Object value)
Depending on Meta.Field.type(), Meta.Field.size() and
options passed to Parser.execute(Binder, int) value
types should be treated as follows:
| Meta.FieldType | value instanceof |
Example |
|---|---|---|
| Meta.FieldType.Char | String or Character if
Meta.Field.size()==1 |
String s = value.toString(); |
| Meta.FieldType.Integer | Integer or Long if
Meta.Field.size()>9 |
int i = ((Number)value).intValue(); |
| Meta.FieldType.Fixed; | Fixed | double d = ((Number)value).doubleValue(); |
| Meta.FieldType.Date | YMD by default;
Integer if options contain Parser.PARSE_DATE_AS_INT |
int i = ((Number)value).intValue(); produces
10000*year+100*month+day (month is in 1..12 range)
.
|
| Meta.FieldType.Time | HMS by default;
Integer if options contain Parser.PARSE_TIME_AS_INT |
int i = ((Number)value).intValue(); produces
10000*hour+100*minute+second (hour is in 0..23
range, rest in 0..59 range)
.
|
field - structure information of the field.value - decoded value or null.void switchOrderbook(Meta.Message source, Meta.Ticker ticker)
Order-book tables (denoted with Meta.Message.isOrderbook()) have
special processing rules. Records of the same security are grouped in
blocks which are handled subsequently one block after another.
Notification is made before the first record of the block is
processed (before initRecordUpdate(Meta.Message)).
Note: this method is NOT called after the last record of
the last block. Appropriate cleanup should take place in
doneTableUpdate(Meta.Message) instead.
This is a place to prepare new or retrieve previous data structures for
order-book records block of the ticker. Previous data (if any) of
the ticker should be cleared, because new data overrides it
completely (never updates). For order-book tables the result returned by
initRecordUpdate(com.micex.client.Meta.Message) is ignored.
source - structure information of the table being parsed.ticker - new ticker (board and paper code combination).