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()
DataRecord
DataScheme
of this field.getScheme
in interface DataRecord
public RecordMapping getMapping()
DataRecord
null
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 DataRecord
public final <T extends RecordMapping> T getMapping(Class<T> mappingClass)
DataRecord
null
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 DataRecord
public Map<Class<? extends RecordMapping>,RecordMapping> getMappings()
DataRecord
getRecord()
method on
any of the resulting record mappings is equal to this data record.getMappings
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 String getName()
DataRecord
DataScheme
.
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 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 final DataField findFieldByName(String name)
DataRecord
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.findFieldByName
in interface DataRecord
null
if not found.public boolean update(RecordCursor from, RecordCursor to)
DataRecord
to
cursor 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 IOException
DataRecord
DataIntField.writeInt(BufferedOutput, int)
and DataObjField.writeObj(BufferedOutput, Object)
.writeFields
in interface DataRecord
IOException
public void readFields(com.devexperts.io.BufferedInput in, RecordCursor cursor) throws IOException
DataRecord
DataIntField.readInt(BufferedInput)
and DataObjField.readObj(BufferedInput)
.readFields
in interface DataRecord
IOException
Copyright © 2002–2025 Devexperts LLC. All rights reserved.