|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.devexperts.qd.kit.DefaultRecord
public class DefaultRecord
The DefaultRecord
is a basic implementation of data record.
Note, that this implementation works only with fields that are derived from
AbstractDataIntField
and AbstractDataObjField
classes.
Field Summary | |
---|---|
protected boolean |
has_time
|
protected int |
id
|
protected AbstractDataIntField[] |
int_fields
|
protected RecordMapping |
mapping
|
protected java.lang.String |
name
|
protected AbstractDataObjField[] |
obj_fields
|
protected DefaultScheme |
scheme
|
Constructor Summary | |
---|---|
DefaultRecord(int id,
java.lang.String name,
boolean has_time,
DataIntField[] int_fields,
DataObjField[] obj_fields)
|
Method Summary | |
---|---|
int |
getId()
Returns identifier of this record. |
DataRecord |
getIncomingRecord()
|
AbstractDataIntField |
getIntField(int index)
Returns Int-field by its index within this record. |
int |
getIntFieldCount()
Returns a number of Int-fields in this record. |
RecordMapping |
getMapping()
Returns mapping for this data record or null if there is no mapping for this record. |
java.lang.String |
getName()
Returns name of this record. |
AbstractDataObjField |
getObjField(int index)
Returns Obj-field by its index within this record. |
int |
getObjFieldCount()
Returns a number of Obj-fields in this record. |
DataRecord |
getResultingRecord()
Returns actual DataRecord that shall be used for subscription. |
DefaultScheme |
getScheme()
Returns parent DataScheme of this field. |
boolean |
hasTime()
Determines if this record contains time coordinate. |
void |
readFields(com.devexperts.io.BufferedInput in,
RecordCursor cursor)
Reads this record's field values in a binary from the specified buffered input. |
void |
readRecord(com.devexperts.io.BufferedInput in,
RecordBuffer buffer,
int cipher,
java.lang.String symbol)
Reads record from the specified input and adds it to the specified cursor. |
static void |
setParentReferences(DataRecord record)
Deprecated. No replacement. Just remove usages of this method. DefaultRecord(int, String, boolean, DataIntField[], DataObjField[]) constructor now does it automatically. |
void |
setScheme(DefaultScheme scheme)
Sets reference to parent data scheme. |
java.lang.String |
toString()
|
boolean |
update(RecordCursor from,
RecordCursor to)
Updates this record's field values in to cusor by values from cursor. |
void |
writeFields(com.devexperts.io.BufferedOutput out,
RecordCursor cursor)
Writes this record's field values in a binary form into a specified buffered output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected DefaultScheme scheme
protected final RecordMapping mapping
protected final int id
protected final java.lang.String name
protected final boolean has_time
protected final AbstractDataIntField[] int_fields
protected final AbstractDataObjField[] obj_fields
Constructor Detail |
---|
public DefaultRecord(int id, java.lang.String name, boolean has_time, DataIntField[] int_fields, DataObjField[] obj_fields)
Method Detail |
---|
public final void setScheme(DefaultScheme scheme)
java.lang.IllegalStateException
- if parent scheme already set to different instance.public static void setParentReferences(DataRecord record)
DefaultRecord(int, String, boolean, DataIntField[], DataObjField[])
constructor now does it automatically.
DefaultRecord
.
java.lang.ClassCastException
- if record is not an instance of DefaultRecord
.
java.lang.IllegalStateException
- if some parent reference already set to different instance.public final java.lang.String toString()
toString
in class java.lang.Object
public final DefaultScheme getScheme()
DataRecord
DataScheme
of this field.
getScheme
in interface DataRecord
public final RecordMapping getMapping()
DataRecord
null
if there is no mapping for this record.
The result of invoking getRecord()
method on
the resulting record mapping (when it is non null) is equal to this data record.
getMapping
in interface DataRecord
public final int getId()
DataRecord
DataScheme
.
It is also used for identification of data record in serialized form.
getId
in interface DataRecord
public final java.lang.String getName()
DataRecord
DataScheme
.
It is recommended that full names of record's fields contain record name
as a prefix like these: "FooRecord.Category", "FooRecord.Amount", etc.
getName
in interface DataRecord
public final boolean hasTime()
DataRecord
hasTime
in interface DataRecord
public final int getIntFieldCount()
DataRecord
getIntFieldCount
in interface DataRecord
public final AbstractDataIntField getIntField(int index)
DataRecord
getIntField
in interface DataRecord
public final int getObjFieldCount()
DataRecord
getObjFieldCount
in interface DataRecord
public final AbstractDataObjField getObjField(int index)
DataRecord
getObjField
in interface DataRecord
public boolean update(RecordCursor from, RecordCursor to)
DataRecord
to
cusor by values from
cursor.
This method is used for implementation of ticker contract.
update
in interface DataRecord
true
if any values were updated and listeners shall be notified on data change.public void writeFields(com.devexperts.io.BufferedOutput out, RecordCursor cursor) throws java.io.IOException
DataRecord
DataIntField.writeInt(java.io.DataOutput, int)
and DataObjField.writeObj(java.io.DataOutput, java.lang.Object)
.
writeFields
in interface DataRecord
java.io.IOException
public void readFields(com.devexperts.io.BufferedInput in, RecordCursor cursor) throws java.io.IOException
DataRecord
DataIntField.readInt(java.io.DataInput)
and DataObjField.readObj(java.io.DataInput)
.
readFields
in interface DataRecord
java.io.IOException
public final void readRecord(com.devexperts.io.BufferedInput in, RecordBuffer buffer, int cipher, java.lang.String symbol) throws java.io.IOException
RecordReader
DataRecord
implementation of this method reads the record itself,
but other implementations might perform complex transformations or do not read
anything at all.
readRecord
in interface RecordReader
java.io.IOException
public final DataRecord getResultingRecord()
RecordReader
null
if this reader does not actually read anything. DataRecord
implementation of this method
returns this
.
getResultingRecord
in interface RecordReader
public final DataRecord getIncomingRecord()
getIncomingRecord
in interface RecordReader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |