public class Token extends Object
Tokens.
The entire IR of an entity is a List of Token objects. The order of this list is
very important. Encoding of fields is done by nodes pointing to specific encoding PrimitiveType
objects. Each encoding node contains size, offset, byte order, and Encoding. Entities relevant
to the encoding such as fields, messages, repeating groups, etc. are encapsulated in the list as nodes
themselves. Although, they will in most cases never be serialized. The boundaries of these entities
are delimited by BEGIN and END Signal values in the node Encoding.
A list structure like this allows for each concatenation of encodings as well as easy traversal.
An example encoding of a message headerStructure might be like this.
| Modifier and Type | Class and Description |
|---|---|
static class |
Token.Builder |
static class |
Token.VersionContext
Indicates how the version field should be interpreted.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
INVALID_ID
Invalid ID value.
|
static int |
UNKNOWN_OFFSET
Offset not computed or set
|
static int |
VARIABLE_SIZE
Size not determined
|
| Constructor and Description |
|---|
Token(Signal signal,
String name,
int id,
int version,
int size,
int offset,
Encoding encoding)
Construct an
Token by providing values for all fields. |
| Modifier and Type | Method and Description |
|---|---|
int |
arrayLength()
The number of encoded primitives in this type.
|
Encoding |
encoding()
|
int |
id()
Return the ID of the token assigned by the specification
|
String |
name()
Return the name of the token
|
int |
offset()
The offset for this token in the message.
|
Signal |
signal()
Signal the role of this token.
|
int |
size()
The size of this token in bytes.
|
String |
toString() |
int |
version()
The version context for this token.
|
Token.VersionContext |
versionContext()
The context in which the version field should be interpreted.
|
public static final int INVALID_ID
public static final int VARIABLE_SIZE
public static final int UNKNOWN_OFFSET
public Token(Signal signal, String name, int id, int version, int size, int offset, Encoding encoding)
Token by providing values for all fields.signal - for the token rolename - of the token in the messageid - as the identifier in the message declarationversion - application within the templatesize - of the component partoffset - in the underlying message as octetsencoding - of the primitive fieldpublic String name()
public int id()
public int version()
versionContext()public Token.VersionContext versionContext()
public int size()
VARIABLE_SIZE means this node represents a variable length field.public int arrayLength()
public int offset()
UNKNOWN_OFFSET means this nodes true offset is dependent on variable length
fields ahead of it in the encoding.Copyright © 2013 Real Logic Ltd. All Rights Reserved.