public class DefaultScheme extends Object implements DataScheme
DefaultScheme
is a basic implementation of data scheme.
It uses record identifier and CompactInt
format for record identity serialization.
Note, that this implementation works only with records that are derived from
DefaultRecord
class and fields that are derived from
AbstractDataIntField
and AbstractDataObjField
classes.Modifier and Type | Field and Description |
---|---|
protected SymbolCodec |
codec |
protected String |
digest |
protected com.devexperts.logging.Logging |
log |
protected DefaultRecord[] |
records |
Constructor and Description |
---|
DefaultScheme(SymbolCodec codec,
DataRecord... records) |
Modifier and Type | Method and Description |
---|---|
static String |
calculateDigest(DataScheme scheme) |
AbstractDataIntField |
findIntFieldByName(String name)
Returns Int-field by its
full name . |
AbstractDataObjField |
findObjFieldByName(String name)
Returns Obj-field by its
full name . |
DefaultRecord |
findRecordByName(String name)
Returns data record by its name.
|
SymbolCodec |
getCodec()
Returns symbol codec used in this scheme.
|
String |
getDigest()
Returns digest of the scheme.
|
DefaultRecord |
getRecord(int index)
Returns data record by its index within this scheme.
|
int |
getRecordCount()
Returns number of records in this scheme.
|
<T> T |
getService(Class<T> serviceClass)
Extension point for additional scheme-specific services.
|
static void |
setParentReferences(DataScheme scheme)
Deprecated.
No replacement. Just remove usages of this method.
DefaultScheme(SymbolCodec, DataRecord[]) constructor now does it automatically. |
String |
toString() |
static void |
verifyScheme(DataScheme scheme)
Deprecated.
No replacement. Just remove usages of this method.
DefaultScheme(SymbolCodec, DataRecord[]) constructor does it all automatically. |
protected final com.devexperts.logging.Logging log
protected final SymbolCodec codec
protected final DefaultRecord[] records
protected String digest
public DefaultScheme(SymbolCodec codec, DataRecord... records)
public final SymbolCodec getCodec()
DataScheme
getCodec
in interface DataScheme
public final int getRecordCount()
DataScheme
getRecordCount
in interface DataScheme
public final DefaultRecord getRecord(int index)
DataScheme
getRecord
in interface DataScheme
public final DefaultRecord findRecordByName(String name)
DataScheme
findRecordByName
in interface DataScheme
public final AbstractDataIntField findIntFieldByName(String name)
DataScheme
full name
.
Returns null if no such fields exists.findIntFieldByName
in interface DataScheme
public final AbstractDataObjField findObjFieldByName(String name)
DataScheme
full name
.
Returns null if no such fields exists.findObjFieldByName
in interface DataScheme
public <T> T getService(Class<T> serviceClass)
DataScheme
null
if no scheme-specific override for the corresponding service is found.
Default implementation in DefaultScheme
is to use
Services.createService(java.lang.Class<T>, java.lang.ClassLoader, java.lang.String)
with this scheme's class loader.
getService
in interface DataScheme
public String getDigest()
DataScheme
Returns null
by default.
getDigest
in interface DataScheme
public static void setParentReferences(DataScheme scheme)
DefaultScheme(SymbolCodec, DataRecord[])
constructor now does it automatically.DefaultScheme
.ClassCastException
- if scheme is not an instance of DefaultScheme
.IllegalStateException
- if some parent reference already set to different instance.public static void verifyScheme(DataScheme scheme)
DefaultScheme(SymbolCodec, DataRecord[])
constructor does it all automatically.public static String calculateDigest(DataScheme scheme)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.