|
20 | 20 |
|
21 | 21 | import java.util.List; |
22 | 22 |
|
| 23 | +/** |
| 24 | + * Callback interface to be implemented by code wanting to decode messages on-the-fly. |
| 25 | + * <p/> |
| 26 | + * If all methods are not required then consider extending {@link AbstractTokenListener} for potential performance benefits and simpler code. |
| 27 | + */ |
23 | 28 | public interface TokenListener |
24 | 29 | { |
| 30 | + /** |
| 31 | + * Called on beginning the decoding of a message. |
| 32 | + * |
| 33 | + * @param token representing the IR for message including meta data. |
| 34 | + */ |
25 | 35 | void onBeginMessage(Token token); |
26 | 36 |
|
| 37 | + /** |
| 38 | + * Called on end of decoding of a message. |
| 39 | + * |
| 40 | + * @param token representing the IR for message including meta data. |
| 41 | + */ |
27 | 42 | void onEndMessage(Token token); |
28 | 43 |
|
| 44 | + /** |
| 45 | + * Primitive encoded type encountered. This can be a root block field or field within a composite or group. |
| 46 | + * <p/> |
| 47 | + * Within a composite the typeToken and fieldToken are the same. |
| 48 | + * |
| 49 | + * @param fieldToken in the IR representing the field of the message root or group. |
| 50 | + * @param buffer containing the encoded message. |
| 51 | + * @param bufferIndex at which the encoded field begins. |
| 52 | + * @param typeToken of the encoded primitive value. |
| 53 | + * @param actingVersion of the encoded message for determining validity of extension fields. |
| 54 | + */ |
29 | 55 | void onEncoding(Token fieldToken, DirectBuffer buffer, int bufferIndex, Token typeToken, int actingVersion); |
30 | 56 |
|
| 57 | + /** |
| 58 | + * Enum encoded type encountered. |
| 59 | + * |
| 60 | + * @param fieldToken in the IR representing the field of the message root or group. |
| 61 | + * @param buffer containing the encoded message. |
| 62 | + * @param bufferIndex at which the encoded field begins. |
| 63 | + * @param tokens describing the message. |
| 64 | + * @param fromIndex at which the enum metadata begins. |
| 65 | + * @param toIndex at which the enum metadata ends. |
| 66 | + * @param actingVersion of the encoded message for determining validity of extension fields. |
| 67 | + */ |
31 | 68 | void onEnum(Token fieldToken, |
32 | 69 | DirectBuffer buffer, int bufferIndex, |
33 | 70 | List<Token> tokens, int fromIndex, int toIndex, |
34 | 71 | int actingVersion); |
35 | 72 |
|
| 73 | + /** |
| 74 | + * BitSet encoded type encountered. |
| 75 | + * |
| 76 | + * @param fieldToken in the IR representing the field of the message root or group. |
| 77 | + * @param buffer containing the encoded message. |
| 78 | + * @param bufferIndex at which the encoded field begins. |
| 79 | + * @param tokens describing the message. |
| 80 | + * @param fromIndex at which the bit set metadata begins. |
| 81 | + * @param toIndex at which the bit set metadata ends. |
| 82 | + * @param actingVersion of the encoded message for determining validity of extension fields. |
| 83 | + */ |
36 | 84 | void onBitSet(Token fieldToken, |
37 | 85 | DirectBuffer buffer, int bufferIndex, |
38 | 86 | List<Token> tokens, int fromIndex, int toIndex, |
39 | 87 | int actingVersion); |
40 | 88 |
|
| 89 | + /** |
| 90 | + * Beginning of Composite encoded type encountered. |
| 91 | + * |
| 92 | + * @param fieldToken in the IR representing the field of the message root or group. |
| 93 | + * @param tokens describing the message. |
| 94 | + * @param fromIndex at which the composite metadata begins. |
| 95 | + * @param toIndex at which the composite metadata ends. |
| 96 | + */ |
41 | 97 | void onBeginComposite(Token fieldToken, List<Token> tokens, int fromIndex, int toIndex); |
42 | 98 |
|
| 99 | + /** |
| 100 | + * End of Composite encoded type encountered. |
| 101 | + * |
| 102 | + * @param fieldToken in the IR representing the field of the message root or group. |
| 103 | + * @param tokens describing the message. |
| 104 | + * @param fromIndex at which the composite metadata begins. |
| 105 | + * @param toIndex at which the composite metadata ends. |
| 106 | + */ |
43 | 107 | void onEndComposite(Token fieldToken, List<Token> tokens, int fromIndex, int toIndex); |
44 | 108 |
|
| 109 | + /** |
| 110 | + * Beginning of group encoded type encountered. |
| 111 | + * |
| 112 | + * @param token describing the group. |
| 113 | + * @param groupIndex index for the repeat count of the group. |
| 114 | + * @param numInGroup number of times the group will be repeated. |
| 115 | + */ |
45 | 116 | void onBeginGroup(Token token, int groupIndex, int numInGroup); |
46 | 117 |
|
| 118 | + /** |
| 119 | + * End of group encoded type encountered. |
| 120 | + * |
| 121 | + * @param token describing the group. |
| 122 | + * @param groupIndex index for the repeat count of the group. |
| 123 | + * @param numInGroup number of times the group will be repeated. |
| 124 | + */ |
47 | 125 | void onEndGroup(Token token, int groupIndex, int numInGroup); |
48 | 126 |
|
| 127 | + /** |
| 128 | + * Var data field encountered. |
| 129 | + * |
| 130 | + * @param fieldToken in the IR representing the var data field. |
| 131 | + * @param buffer containing the encoded message. |
| 132 | + * @param bufferIndex at which the variable data begins. |
| 133 | + * @param length of the variable data in bytes. |
| 134 | + * @param typeToken of the variable data. Specifically needed to determine character encoding of the variable data. |
| 135 | + */ |
49 | 136 | void onVarData(Token fieldToken, DirectBuffer buffer, int bufferIndex, int length, Token typeToken); |
50 | 137 | } |
0 commit comments