public class DefaultRecord extends Object implements DataRecord
DefaultRecord is a basic implementation of data record.
Note, that this implementation works only with fields that are derived from
AbstractDataIntField and AbstractDataObjField classes.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
has_time |
protected int |
id |
protected String |
name |
| Constructor and Description |
|---|
DefaultRecord(int id,
String name,
boolean hasTime,
DataIntField[] dataIntFields,
DataObjField[] dataObjFields) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFieldAlias(String oldName,
String newName) |
DataField |
findFieldByName(String name)
Finds field by its full
name,
or by its local name,
or by its property name,
or by its default property name that is created from its local name
using AbstractDataField.getDefaultPropertyName
method. |
int |
getId()
Returns identifier of this record.
|
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 such mapping for this record. |
<T extends RecordMapping> |
getMapping(Class<T> mappingClass)
Returns specified mapping for this data record or
null if there is no such mapping for this record. |
Map<Class<? extends RecordMapping>,RecordMapping> |
getMappings()
Returns all mappings for this data record.
|
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.
|
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 |
setScheme(DefaultScheme scheme)
Sets reference to parent data scheme.
|
String |
toString() |
boolean |
update(RecordCursor from,
RecordCursor to)
Updates this record's field values in
to cursor 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.
|
protected final int id
protected final String name
protected final boolean has_time
public DefaultRecord(int id,
String name,
boolean hasTime,
DataIntField[] dataIntFields,
DataObjField[] dataObjFields)
public final void setScheme(DefaultScheme scheme)
IllegalStateException - if parent scheme already set to different instance.public final DefaultScheme getScheme()
DataRecordDataScheme of this field.getScheme in interface DataRecordpublic RecordMapping getMapping()
DataRecordnull if there is no such mapping for this record.
If data record has multiple mappings then the first processed mapping will be returned.
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 DataRecordpublic final <T extends RecordMapping> T getMapping(Class<T> mappingClass)
DataRecordnull if there is no such 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 DataRecordpublic Map<Class<? extends RecordMapping>,RecordMapping> getMappings()
DataRecordgetRecord() method on
any of the resulting record mappings is equal to this data record.getMappings in interface DataRecordpublic final int getId()
DataRecordDataScheme.
It is also used for identification of data record in serialized form.getId in interface DataRecordpublic final String getName()
DataRecordDataScheme.
The naming convention for record names is to use CapitalizedNames
without separators and to prefer one-word names,
like "Quote", "Trade", "TimeAndSales", etc.getName in interface DataRecordpublic final boolean hasTime()
DataRecordhasTime in interface DataRecordpublic final int getIntFieldCount()
DataRecordgetIntFieldCount in interface DataRecordpublic final AbstractDataIntField getIntField(int index)
DataRecordgetIntField in interface DataRecordpublic final int getObjFieldCount()
DataRecordgetObjFieldCount in interface DataRecordpublic final AbstractDataObjField getObjField(int index)
DataRecordgetObjField in interface DataRecordpublic final DataField findFieldByName(String name)
DataRecordname,
or by its local name,
or by its property name,
or by its default property name that is created from its local name
using AbstractDataField.getDefaultPropertyName
method.findFieldByName in interface DataRecordnull if not found.public boolean update(RecordCursor from, RecordCursor to)
DataRecordto cursor by values from cursor.
This method is used for implementation of ticker contract.update in interface DataRecordtrue if any values were updated and listeners shall be notified on data change.public void writeFields(com.devexperts.io.BufferedOutput out,
RecordCursor cursor)
throws IOException
DataRecordDataIntField.writeInt(BufferedOutput, int) and DataObjField.writeObj(BufferedOutput, Object).writeFields in interface DataRecordIOExceptionpublic void readFields(com.devexperts.io.BufferedInput in,
RecordCursor cursor)
throws IOException
DataRecordDataIntField.readInt(BufferedInput) and DataObjField.readObj(BufferedInput).readFields in interface DataRecordIOExceptionCopyright © 2002–2025 Devexperts LLC. All rights reserved.